|
Hi Everyone,
I am using webbrowser control in my application. After when webbrowser navigates to the specified url, it is not possible to close the browser because of tabbed browsing. Please help me in fixing the issue through code.
Thanks in Advance.
Regards,
Manowj
|
|
|
|
|
Can you share the code you are using to initiate the browse in the browser control.
I don't follow what you mean by unable to close the browser. its a control in your app after all.
|
|
|
|
|
manowj wrote: , it is not possible to close the browser because of tabbed browsing.
Do you get some sort of error? What have you tried to implement this?
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
Thanks in advance.
I want to Update Visual Studio 2008 to Framework 2008 sp 1 on a system where i dont have internet Access, Is there any solution for this. As it connects to internet during installation and downloads from the internet
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
Most of the Microsoft products can be downloaded as an ISO image and then burned to DVD. If you have access to the internet elsewhere you can use this method.
I must get a clever new signature for 2011.
|
|
|
|
|
You should be able to download a solution that does not need internet access from another machine. The file would be a lot larger and you will have to search to find it.
|
|
|
|
|
VS 2008 SP1 download [^]page has a link to the iso file format[^] at the bottom of the page.
You will need to downloaded from a machine that has internet access, then burn it to CD or DVD.
|
|
|
|
|
I have in mind an app for work that will let people easily schedule vacation time and also view others' scheduled vacations. We have an informal system now which often leads to multiple key individuals taking the same days off during the year, because of a lack of coordination. What I have in mind is something like a free-standing Outlook calendar which can hold multiple entries for each day.
I haven't worked with datagrids before, but I have a general idea of what they can do. What I had in mind was an overall grid with cells representing days of the month, each containing another grid to display the names of the employees scheduled to be out that day. Ideally an employee could view the period to be scheduled, enter a range of days to be off, and have them displayed as pending until the boss views the page and approves the time off.
Is this the right tool for the job, or am I barking mad (again)?
Will Rogers never met me.
|
|
|
|
|
There are several Month Calendar implementations here in the CP Articles, both Web and WinForms.
My view is that almost all of them would be better than a DataGrid but particularly those that are of the appointment tracker type.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
That's why I was considering the possibility that I might be insane to try it. I see a lot of questions in the C# forum about datagrids, which leads me to believe that they're bad news. I've looked through a lot of articles for month calendars, here and elsewhere, but all seem lacking. But it's been a while, so I'll look again. Thanks!
Will Rogers never met me.
|
|
|
|
|
Unlike many here on CP I think the DataGridView is great, even for data entry. Provided that it is solely for your own use, that is.
Whichever way you decide to go is going to mean some amount of modification to an existing control. The amount involved to do it with the DGV is, in my opinion, far, far greater than would be required for someones' Calendar Control (The MS MonthCalendar is so sealed that it is not in the running BTW).
I have just found Calendar DayView Control[^] which while it is not exactly what you want, does bring lots of possibilities to my mind. (Download the Demo Project and run it, rather than just look at the images in the article.)
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
|
|
|
|
|
That may actually work well, Henry - Thanks!
I'd have to eliminate the hours part, replacing it with just blank lines for names, and add a database for retaining start and stop dates along with the associated name. But the basic framework is all there. Nice find!
Will Rogers never met me.
|
|
|
|
|
Datagrids aren't bad news, but they aren't the best tool for everything. You are asking about a wrench when a pair of pliers would probably be a better choice.
|
|
|
|
|
Along with the other places you've been given to look, this is a lovely javascript version: http://dhtmlx.com/docs/products/dhtmlxScheduler/index.shtml[^]
Of course, you didn't specify whether it was desktop or browser...so this might be a completely useless answer.
modified on Friday, January 21, 2011 7:12 PM
|
|
|
|
|
I actually had a desktop app in mind, but that's quite a nice tool; I might just make it web-based, since we do have an entirely unused IIS installation on the work server. Thanks!
Will Rogers never met me.
|
|
|
|
|
I'm trying to create a lookup that can be used in many places within my application, it is to display a list of activities. It is to be used in several places, each with their own DataContext, as the application dosn't have one static context used by all forms. All instances of the context are from the same Entity Model.
The first issue i had was on one form i have a databound list view containing usercontrols as the item template, this user control contained the lookup in question. The lookup needs to share the same context as the form. This was a bit of an issue as i could not find an simple way of doing this, so i created an event in the lookup that requests a context, this is handled by the form.
The lookup contains a Dependancy Property called Value, of the type Activity, the user control binds its Activity to the Value, but also shows some other information about the activity, this is where my issue is, this fails to update when the activity is changed. Ideally i would like to avoid any process that manually updates this information, and have it done through bindings, any help would be greatly appreciated.
Form - For Simplicity i've moved the required parts of the usercontrol into the form
<ListView Name="lvwTimeCharges" Margin="0,34,0,0">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<my:uscActivitiesLookup Width="200" Value="{Binding Path='Activity', Mode=TwoWay}" ContextRequested="child_ContextRequested"/>
<Label Content="{Binding Path='Activity.sActivityCode'}"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
cEntities Context = new cEntities();
Staff s = null;
Guid gStaff = new Guid("99772C66-B379-4124-839B-3427AE3481C4");
Guid gRate = new Guid("987E3837-F099-481E-BC5C-544BC04361BC");
public MainWindow()
{
InitializeComponent();
s = (from staff in Context.Staff where staff.gStaffID == s select staff).First();
DataContext = s;
lvwTimeCharges.ItemsSource = (from c in s.Charges where c.Rate.gRateID == gRate select c);
}
private void child_ContextRequested(iWantzContext sender, EventArgs e)
{
sender.Context = Context;
}
private void button1_Click(object sender, RoutedEventArgs e)
{
Context.SaveChanges();
}
Lookup
<ComboBox Name="cmbActivities" SelectionChanged="ComboBox_SelectionChanged" DisplayMemberPath="sActivityDescription"/>
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(Activity),typeof(uscActivitiesLookup),new PropertyMetadata(ValueChangedCallback));
private static void ValueChangedCallback(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{
if ((obj as uscActivitiesLookup).Context != null)
(obj as uscActivitiesLookup).cmbActivities.SelectedItem = e.NewValue;
}
public uscActivitiesLookup()
{
InitializeComponent();
}
public Activity Value
{
get { return (Activity)GetValue(ValueProperty); }
set {SetValue(ValueProperty, value);}
}
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (Context != null)
Value = cmbActivities.SelectedItem as Activity;
}
private IEnumerable<TimeRecordingActivity> lookupValues;
private void PopulateCombo()
{
lookupValues = from a in _context.Activities where a.bDeleted == false select a ;
cmbActivities.ItemsSource = lookupValues;
if (Value != null)
cmbActivities.SelectedItem = Value;
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
ContextRequested(this, null);
}
#region iWantzContext Members
public event ContextSharing.ContextRequestedEventHandler ContextRequested;
cEntities _context = null;
public cEntities Context
{
get
{
return _context;
}
set
{
_context = value;
PopulateCombo();
}
}
#endregion
The sActivity Code fails to update, but if a savechanges is performed on the context and the form is refreshed the Activity has been successfully updated.
modified on Friday, January 21, 2011 6:47 AM
|
|
|
|
|
Any reason why you're using data binding to bind your control to the data model, but then dropping back to WinForms-style event handling to link the combo box to the containing control?
<ComboBox
DisplayMemberPath="sActivityDescription"
DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl}}"
SelectedItem="{Binding Value,Mode=TwoWay}"
ItemsSource="{Binding LookupValues}"
/>
(Or you could put the actual type of your control there instead of UserControl)
To make this nice and clean, change your private "lookupValues" into either a DependencyProperty or one that fires off an INotifyPropertyChanged.PropertyChanged event.
That way, the combo is always bound to the Value property, and its ItemsSource is always bound to your internal list. You never have to catch any events from it, and you don't even need to assign a name to it. That's how WPF is meant to be used... Let the bindings do the work, so you never have to worry about keeping things synchronized.
Ed Hill _5_ wrote: private void child_ContextRequested(iWantzContext sender, EventArgs e)
|
|
|
|
|
Thanks for your reply, code project seemed to go down for a while yesterday, so was only able to read throug it now. I will give this a try and let you know how it works, or more likly if i have any questions.
Ian Shlasko wrote: Any reason why you're using data binding to bind your control to the data model, but then dropping back to WinForms-style event handling to link the combo box to the containing control?
In answer to your above question, this is my first project that i have used both entity framework and WPF so i am learning as i go, and unfortunatly when i'm not sure how to do things i fall back on the old win forms way of working. I'll get there in the end its just a but of a learning process for me.
|
|
|
|
|
Ed Hill _5_ wrote: In answer to your above question, this is my first project that i have used both entity framework and WPF so i am learning as i go, and unfortunatly when i'm not sure how to do things i fall back on the old win forms way of working. I'll get there in the end its just a but of a learning process for me.
No problem... Sorry if that came off as hostile... Wasn't sure if you had an actual reason for doing it that way - Some situation that data binding couldn't handle. But if you're just new to WPF... Well, we were all new at some point. Took me a while to get the hang of it, but now WinForms seems almost backwards by comparison.
Generally, the goal in WPF is to completely separate the GUI from the code-behind... So the GUI knows nothing about the code and the code knows nothing about the GUI. Only the model is shared between them. The only time you should even have to assign a name to a WPF control and refer to it in the code, is for those odd situations where data binding isn't good enough.
If the code needs to make a change to the GUI, it should instead be doing something to the model, which the GUI would detect and react to. It sounds unnecessary, but it's actually pretty powerful.
For example, a button on the GUI could have its IsEnabled property bound to a boolean property on the model. The property changes and the button is now ready to be used. Sometime later, you could decide to overhaul the GUI and make it flashy and attractive, so instead of just having a button enable itself, you could have the infamous Clippy fly onto the screen and pop up a little speech balloon saying "All set! Click here!", and simultaneously have a custom animated button-type thing light up with blinking text and... well, you get the idea... All of that could be triggered just by setting that single boolean property on the model, and you could do all this without making a single change to the model or the business logic.
So in short... I think the Name property is the key... If you find yourself referencing a GUI control by name in the code, you need to take a step back and ask yourself if there's a better way.
|
|
|
|
|
Ok looking back through my origional question it looks like i have said DataContext when i should have been saying ObjectContext. I believe the DataContext is being set through databinding as it should be, its the object context that I was resorting to the old windows way of doing things to pass about. If it helps i have uploaded a copy of a project i am using to test this and a screen shot of the entity model.
Object Context Screen Shot
Project Zipped
|
|
|
|
|
Ok think i have solved the issue i was having, wit the lookupnot updating the control it was on, the cause was only scalars automatically trigger a change notification, the solution was adding the following to a partial class.
public partial class Charge
{
public Charge()
{
this.ActivityReference.AssociationChanged += new System.ComponentModel.CollectionChangeEventHandler(ActivityReference_AssociationChanged);
}
void ActivityReference_AssociationChanged(object sender, System.ComponentModel.CollectionChangeEventArgs e)
{
if ((e.Action == System.ComponentModel.CollectionChangeAction.Remove))
OnPropertyChanging("Activity");
else
OnPropertyChanged("Activity");
}
}
If any one is able to share a best practice way to make the lookup use the same ObjectContext as the Window is using that would be most helpful. I think the line below outlines the situation i am in, and the aim is for the cEntities Context = new cEntities(); from the window to be used in the lookup when popluating the ComboBox.ItemsSource .
Window>Databound List View>Item Template>Lookup User Control
|
|
|
|
|
Hi,
I'm new to LINQ concept the requirement what i have is, I have a string column with data as below
OR0
OR1
OR2
.
.
OR9
.
.
OR21
ORD
Now i want to order it as above, but when i do order by i get data as below as it is ordering as string
OR0
OR1
OR10
OR11
OR12
.
.
OR19
OR20
OR21
OR3
.
.
OR9
ORD
Which is wrong as per my requirement.
I tried ordering as Order By Len(Col),Col and the o/p what i received is
OR0
.
.
OR9
ORD
OR10
.
.
OR21
Can any one help me with giving me a proper Order By statement for LINQ statement?
Regards,
Kishan
|
|
|
|
|
What you're looking for is known as a "Natural Sort," and there are plenty of implementations online. Unfortunately, as far as I'm aware, LINQ does not have this functionality built-in, so you have to code it yourself.
If you can translate a bit of C# code, this site[^] has a LINQ-based solution.
|
|
|
|
|
Thank you for your kind reply.
Can i know How to get the count of Alplabets in a Alphaneumeric column using LINQ
like
OR0 - 2
OR1 - 2
.
.
OR10 - 2
.
.
ORD - 3
If i can get this, i can achieve my requirement
Thanks in advance.
|
|
|
|
|
That won't be enough for a natural sort, unless you can guarantee that your input will always be letters (possibly) followed by numbers... What if one of your items was "OR10A"? Three letters, but should be before "OR2". What happens if you have something more complicated, with multiple sets of numbers in between letters?
But... If you're absolutely sure that your input will always follow this pattern, then you could take that shortcut by writing a quick function to count the number of letters... Something like this (Sorry if my syntax isn't perfect):
Public Function NumberOfLetters(s as String) as Integer
For idx As Integer = 0 To s.Length - 1
If Not Char.IsLetter(s(idx)) Then Return idx - 1
Next
Return s.Length
End Function
|
|
|
|
|