|
The application is halted when it hits a breakpoint. Hence, it will not paint the form.
You can add a "watch" in order to inspect the value though
|
|
|
|
|
Yes you are right but any other way instead of adding watch window because my scenario involves so many controls and grids any how thanks for Helping
|
|
|
|
|
Call Application.DoEvents() after setting the textbox value.
while (e) { Coyote(); }
|
|
|
|
|
Hello All,
I have list that is globally declared and i have add button which will add one object to the list once it clicked .
I am binding this list to grid .
for the first time when i click add button item is added to the list and binded to grid too.
when i again click the same then it added the item to the list but still not reflected to grid and then i have done some modifictions and get the result.
please find the code
private void btnAdd_Click(object sender, EventArgs e)
{
objSapient.Add(new SapientDetails(txtName.Text,txtSapientID.Text,txtProjectName.Text,txtPhoneNumber.Text,txtExpr.Text));
if (objSapient.Count != 0)
{
grvDetails.DataSource = null;
}
grvDetails.DataSource = objSapient;
}
why do i need to set as datasource to null ?
why just grvDetails.DataSource = objSapient; is not sufficeint .
Please tell the reason for the same
|
|
|
|
|
Not sure about this behaviour.
But to avoid setting the datasource to null, use a BindingSource object to set the datasource of the DataGridView. Set the DataSource of the object as your list. And on button click, just add the item to the BindingSource object. This will add item to both the List and the DataGridView.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
When I code a Setter for a property, I usually do it like this
public int SomeProperty
{
get
{
return this.someField;
}
set
{
if (this.someField != value)
{
this.someField = value;
this.Invalidate();
}
}
}
and this is probably what is happening in your case. Setting a field to the value that it already holds, results in nothing actually happening.
To solve your problem you really need to use the more complex version of DataBinding which includes change management. So that changes you make to objSapient are automatically reflected by the binding.
Take a look at the documentation for BindingSource , or Google for complex databinding to objects (or similar)
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'm coding a program. My database have table, it's name tblSinhVien. In it have a column is Image, type is Nvarchar to save path of image.
I want to display image in Crytal Report but I don't know to use path of image to load image in Crytal Report.
Can you help me?
I thank you very much!
|
|
|
|
|
Hi,
I am going to edit and update record in datagrid , every time I am able to edit or update one record and again I m going to click button of grid view getting this error “Cannot set the SelectedValue in a ListControl with an empty ValueMember.” .. then again close to application and able to do edit and update any one record…
Vinay
|
|
|
|
|
Your explanation made absolutely no sense what-so-ever.
|
|
|
|
|
Hi Vinay,
With this minimum explanation, it seems that you are using data binding. Also, you have some ListControl in your form as well which is related to the same datasource (i.e. same datatable might be used for Grid and that control). This list control does not have blank value in its master data.
Verify this one otherwise try to debug (setting break points whereever ValueMember is set) your code to find out where you are getting the error.
|
|
|
|
|
I am having two comboboxcontrol on Winform2008, whenever I am selecting value from one combo , then same text is coming in second combo, but just I want to separation in both ..
Vinay
|
|
|
|
|
Use different datasource for each combobox, even if the data are the same.
|
|
|
|
|
|
So are you saying that each combo should point to a different copy of the save data? Isn't that a little inefficient??
|
|
|
|
|
All you need to do is create two BindingSource objects and put them between the Combo's and the data. Each Combo will have its DataSource property set to one of the BindingSource objects. Then each BindingSource will have it's DataSource property point to the same data object. Something like this:
ComboBox1.DataSource ------> BindingSource1 -----\
\
+----> Data
/
ComboBox2.DataSource ------> BindingSource2 -----/
|
|
|
|
|
See that's why I skulk around here, I have used the table.copy method to achieve this in the past as I have never used a bindingsource as a datasource for a combo.
Thanks Dave
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Glad it'll help you. It's just a little something I found in someone elses brain droppings.
|
|
|
|
|
Dave Kreskowiak wrote: It's just a little something I found in someone elses brain droppings
Yikes. The things you poke in.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I want to handle Edit and update both from one Button control in Winform2008, let me know , how can I do this….
Vinay
|
|
|
|
|
Set/check the text of the button in the onclick event.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Not enough information to answer your question. The biggest problem with this design is how is the button click handler going to know the difference in the users intent when the button is clicked??
|
|
|
|
|
Keep a Form level variable to get the mode of the screen.
private String mode = "Edit";
Now change this mode whenever, your form's mode is being changed.
Based on this private varible you can decide the text of the button.
btnSave.Text = (mode == "Edit")?"Edit" : "Update";
Hope this yould help you.
Regards,
Arindam Sinha
|
|
|
|
|
This question is as old as the dawn of windows itself, but this time round with more parameters added. I know all about SDI and MDI development, but I want to rest a case of which is best in terms of processing power. I have used both in my developing career and fully understand the pains and gains of each except:
In terms of .NET 2+ and C#:
Which is best in terms of performance: a MDI with a menu bar and two child forms - no matter the content - or two SDI's with the same menu bar and corresponding content. Forget the effeort to link the forms and carra data over from the one to the other - performance only, processing power, memory usage/footprint, JIT, GC etc.
The real reason for this is I need to have some expert advice to shut some mouths shooting off in only one direction. If you can point me, give expert advice, direction or whatever to state a case I'll appreciate it dearly.
|
|
|
|
|
In my opinion since MDI would require three forms (one father and two childs), the memory footprint will sure be slightly larger.
The same goes for computing power, since there will be three forms, all with their message management and so on.
But I doubt this will have any serious impact on the application, unless you are counting bytes or CPU cycles. And if you are doing that, you're better off using C++ or some other lower level language.
I think the real question is: how would you implement your solution with MDI and with SDI, and which would be the most performing / better ? You may discover that the changes in the implementation carry some benefit for one or the other. So the choice would depend on that, not on religion wars between SDI and MDI.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
I have similar thoughts - no wars. Figure out what you want to use and use the appropriate method - 6 of the one and half a dozen of the other in terms of usability and performance. The other option is WPF, but in my case it will not work properly in a Terminal Services / Citrix environment - bandwidth too expensive...
"the confused are confused beyond confusion" - Pik Botha (1990)
|
|
|
|