|
Just a bit more info.
The DataGridView on the form is one that I have subclassed from System.Windows.Forms.DataGridView
It has the following handler declared in its ctor.
this.CellFormatting +=new DataGridViewCellFormattingEventHandler(DGVEnhanced_CellFormatting);
If I comment this out then the problem goes away. If I leave it in (even if the DGVEnhanced_CellFormatting function is empty and does nothing, then the fault resurfaces. Very strange...
|
|
|
|
|
Now i am working gridview so convert this code and replay to me..
modified on Saturday, February 16, 2008 7:19 AM
|
|
|
|
|
I have wizard kind of Windows Application with Forms having Prev and Next buttons. Currently i have set the Location for all the Forms on Form_Load() method using this.Location = new Point(100, 100);
Now my requirement is that when using "Extend my Windows desktop onto this monitor” setting in Display/Settings Properties, the form should stay in the user’s selected monitor. When i go to the Next form it defaults to the main monitor.
I tried removed the size setting on Form_Load but when i navigate to the next/prev forms the location of the form is not properly set. It randomly positions itself.
How can i do this?
|
|
|
|
|
I'm not sure if I'm understanding you fully, do you mean you're using dual screens and you want the form to load on the screen it did last time?
There are a number of types of default form position.
Look at the form's StartPosition property.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Yes that right. I'm using dual screens and i want the next form to load on the screen as how the previous form occupied 2 screens. How can i do that?
|
|
|
|
|
Hi,
Below you see the string array which I am populating BUT I would like to populate dynamically becuase the dataset where the data is coming from may have different number of records each time.
Could you please correct the preferred method mentioned below as it seems I can not use .Add to add into the string array.
p.s. I do not want to use an arraylist
Thanks
Present method:
private string[] _securities = null;
_securities = new string[]
{
"XS0166639566 corp cusip","XS0184546371 corp cusip", "XS0307767474 corp cusip"
};
Preferred method:
private string[] _securities = null;
foreach (DataRow row in dsSecuritiesDetails.Tables[0].Rows)
{
//something to add here to add to the string array...
//i.e. _securities.Add(row["field2"].ToString()) + " corp cusip";
}
|
|
|
|
|
|
string[] _securities = null;
_securities = new string[]
{
"XS0166639566 corp cusip","XS0184546371 corp cusip", "XS0307767474 corp cusip"
}; And then, whenever you need to add a string:
Array.Resize<string>(ref _securities, _securities.Length + 1);
_securities[_securities.Length - 1] = "The new string";
</string>
SkyWalker
|
|
|
|
|
No, please don't do that.
There is no way of resizing an array in .NET. What the Resize method does is to create a new array with the desired size and copy all the data from the old array.
If you do this in a loop, the performace degrades exponentially to the number of items.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
It was not about performance, why are you so upset?
He could use the StringCollection , but he simply wanted to use the string[] (I don't know why, ask him for that ). I just offered a solution to what he wanted.
Peace
SkyWalker
|
|
|
|
|
Mircea Puiu wrote: It was not about performance, why are you so upset?
I'm not upset. I just wanted to point out that the solution is generally a bad method to use.
Eventhough the question didn't mention performance, some solutions scale so badly that they should never be suggested without explaining what happens when you use it with more than a minimal set of data.
Mircea Puiu wrote: I just offered a solution to what he wanted.
No, you offered a solution to what he thought that he wanted.
Just because he asked for it doesn't mean that it's the method that he should use.
People often don't know what to ask for. It's quite common that they ask for the solution that they think that they should use rather than a solution to the actual problem that they have.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
You are right again ...
Have a nice weekend!
SkyWalker
|
|
|
|
|
voted 5 to even up the low-brain low-voters and because your advise was good.
|
|
|
|
|
Yes, his point is well taken!
SkyWalker
|
|
|
|
|
Use a list instead of an array:
private List<string> _securities = new List<string>();
foreach (DataRow row in dsSecuritiesDetails.Tables[0].Rows) {
_securities.Add(row["field2"].ToString() + " corp cusip");
}
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Hi,
use a collection (StringCollection, ArrayList, or generic List< string>) as others
indicated.
Then convert it to an array if you really need an array. ArrayList and generic List
have a ToArray() method for that purpose.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
hi,
i have selected a camera for a live view through vlc i want to draw a rectangle in the certain areas of vlc.Is there any solutions for this problem.
Thanks in advance
Aparna
|
|
|
|
|
Aparna.B wrote: i have selected a camera for a live view through vlc i want to draw a rectangle in the certain areas of vlc.Is there any solutions for this problem
Probably.
|
|
|
|
|
Hi all,
is there a way to cast a System.Windows.Controls.UserControl (.Net 3) to a System.Windows.Forms.Control (.Net2) ?
I have a Plugins system and I'm trying to plug some .Net3 components
Assembly l_assembly = Assembly.LoadFrom(AssemblyName);
Type l_type = l_assembly.GetType(TypeName, true);
Control l_itemControl = Activator.CreateInstance(l_type) as Control;
here I catch an Exception when I load a "Custom Control Library (WPF)"
Thanks
|
|
|
|
|
lkort wrote: is there a way to cast a System.Windows.Controls.UserControl (.Net 3) to a System.Windows.Forms.Control (.Net2) ?
No, there isn't. You cannot use a .NET 3.0 component in a .NET 2.0 app. You cannot load two different versions of the .NET CLR runtime into the same process.
Also, .NET 2.0 does not support WPF, so you can't do this at all.
You can do the opposite though. You can load a component that was developed under .NET 2.0 in a .NET 3.0 runtime app.
modified on Friday, February 15, 2008 10:52 AM
|
|
|
|
|
I have a form with multiple TextBox controls and few other controls like comboBox, checkBox etc. I'm trying to implement Undo functionality for all the controls in the form. I'm using Push & Pop operations of Stack to store the control values.
My question is regarding the TextBox control. I would like to know on which event of TextBox control i can save the Text in the stack. If i use TextChanged event, then this event is triggered on each character typed.
I also know that TextBox Base provides Undo functionality but i dont want to use that, since my form contains multiple TextBox and other controls as well. And i would like to perform the Undo operation in sequence. Please help!
|
|
|
|
|
You could use Validating or MouseLeave event to check if the text has changed and store new value in stack
|
|
|
|
|
Hi guys
[The senario]
i have a form (FrmUsers) that selects some columns from my userTable and then databinds it to a DataGridView on creation
when the user double clicks a row in the datagrid view an instance of (FrmAddUser) displays with the selected users details filled in
then when you close (FrmAddUser) after editing, the user the data is updated to my db
[the question]
how do i tell (FrmUsers)with the DataGridView that instantiated the AddUser Window that it has to redo the data binding as to reflect the changes?
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
Hello,
Tasks like this are mostely done with modal Windows called with ShowDialog().
The DialogResult of FrmAddUser tells FrmUsers if he has to Update his values.
The initialized Properties could be passed over the constructor from FrmAddUsers.
The return values could be passed over properties from FrmAddUsers.
pseudocode:
using(FormAddUser addUser = new FormAddUser(object initValues))
{
if(addUser.ShowDialog() == DialogResult.OK)
{
object actUserInfos = addUser.ActUserInfos;
...
}
}
You should also think of, if it makes sence to instanciate your FormAddUser always new.
All the best,
Martin
modified on Friday, February 15, 2008 6:29 AM
|
|
|
|
|
thanx martin!
never thaught of that... YOU ROCK as usual
TTYL
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|