|
|
|
Hi all. I want to get the columns in a DataGrid as an Array and i am trying such a piece of code:
foreach (DataGridViewColumn column in dataGridAppointments.Columns)
{
...
}
Where dataGridAppointments is a DataGrid control. I keep on getting the error message:
'System.Windows.Forms.DataGrid' does not contain a definition for 'Columns'.
How can i manage to loop through the collection of columns.
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
dataGridAppointments is not a DataGridView.
|
|
|
|
|
Thanks. So how do i get the columns in the DataGrid?
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Just for example :
DataGrid dataGrid;
.
.
.
to get Cell :
dataGrid[0, 0] -> means cell at row 0 and column 0
.
.
.
so... you can enter any number.
|
|
|
|
|
If you are in fact using a DataGrid you cannot use DataGridViewColumn since the DataGrid and the DataGridView are two different classes. I believe the DataGrid is in the System.Web.. namespace and DataGridView in the System.Windows.Forms namespace. Are you developing a WinForm application or a webb application?
|
|
|
|
|
Calla wrote: I believe the DataGrid is in the System.Web.. namespace and DataGridView in the System.Windows.Forms namespace. Are you developing a WinForm application or a webb application?
You're wrong.
DataGrid is a control in System.Windows.Forms
It's just way older than DataGridView and does not have a Columns collection.
var question = (_2b || !(_2b));
|
|
|
|
|
Okay then.. my bad
|
|
|
|
|
so ive got a webbrower which is filling in a form.
im using a listview to fill in different data for each listview item.
i call the fill webpage method, but i cant pass any variables to it, because its a documentcompleted event.
so i tried config settings, but it goes so fast that the settings dont change in time and they send the same data over and over, the amount of times is the amount of items.
so this is what i have:
private void cmd_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in lvAccounts.Items)
{
Properties.Settings.Default.iEmail = iEmail;
Properties.Settings.Default.tehEmail = tehEmail;
Properties.Settings.Default.Save();
webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(SendMail);
webBrowser1.Navigate(myURL);
}
}
private void SendMail(object sender,WebBrowserDocumentCompletedEventArgs e)
{
HtmlDocument document = webBrowser1.Document;
document.GetElementById("to").SetAttribute("value", Properties.Settings.Default.iEmail);
document.GetElementById("body").SetAttribute("value", Properties.Settings.Default.tehEmail);
document.GetElementById("submit").InvokeMember("click");
}
thats the only way i see that i can pass variables on.
but i really need to know how to, because it sends the same thing, and sometimes the second on the list, if the list is long and takes a long time.
i basically want it to fill in the webbrowser one time with each listview item, with the different values.
please help
|
|
|
|
|
Hello. I got a code here in codeproject.com about radix sorting but it only sorts int based data. I want to use it to sort a string based data. My first try is I got first the ASCII codes of each characters in the strings then passed it in the radix sort code but what it gives me is totally different.
This is the link of the code that I got:
click here
Here is the output after getting the ASCII codes and pass it to the radix sort:
SHOW DATABASE: SORTING BY LAST NAME
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
97
97
97
110
110
111
111
111
114
115
115
115
117
122
122
What should I do for it to be able to sort string?
modified on Friday, September 4, 2009 6:02 AM
|
|
|
|
|
It would be more sensible to write a sort routine that accepts strings and sorts them by character order. Alternatively you could use one of the built in List/Array etc types that support sorting via one of their member functions.
|
|
|
|
|
Hi,
I don't know why you insist on using radix sort, as it will be slower than a regular sort when sorting strings.
Here is how it could work:
- determine the length L of the longest string;
- treat all strings as having length L by virtually appending NULL characters;
- the Nth "digit" of a string has a value that equals the (int) value of its Nth character (where you use zero if N exceeds the string length).
So sort all strings according to their (L-1)th character
then sort according to their (L-2)th character
etc
and finally sort according to their first character
As I said, it will be slow, as you have to get the characters, one by one, and compare those, whereas a normal sort would be based on a comparer method (such as string.Compare) that takes the whole string into account right away.
|
|
|
|
|
hello guys,
I am in a situation where I have an application that needs to be called from another application and then pass parameters and set properties to this application.
I cannot do this by Reflection as its not a DLL, and I cannot do it by calling Process.Start(..,arguments); and pass the arguments because the application dosen't have a public static void Main method.
Do you know any way in which i can achieve this guys?
|
|
|
|
|
??? What kind of application is that ???
Not a DLL but an EXE without start point ???
|
|
|
|
|
Yes sorry you have a point it has a public static void Main sorry my mistake . This is a normal windows forms application C#. now the thing is i can pass strings to the main method but i need to pass a reference to an instance of something. is that possible?
|
|
|
|
|
|
You can't pas a reference between processes. The reference will not valid in the process you're passing it to.
|
|
|
|
|
|
I am using VS 2005 and i have to read some images in the form of byte arrays and get those arrays in another form where i have to use these values and save them to database in Sql server. But the problem is that i am not able to read byte arrays from one form to another form. Please help. Any help would be appreciated.
Thanks
|
|
|
|
|
Hi,
what do you mean by "not able to read byte arrays from one form to another form"? Couldn't you just pass the byte-array within the constructor, a method, session-object etc.?
Regards
Sebastian
|
|
|
|
|
There are two different approaches fo passing data between objects depending on the relationship.
If the sending form instanciates the receiving form, then the receiving form should have a public property or method that is used to receive the data.
If the sending form was instanciated by the receiveng form then it should raise an event along with a custom event args instance (a class derived from System.EventArgs that holds the data to be passed).
If the forms are not so closely related, then a combination of these methods is often the best solution so the property/method or event is propogated up/down the class hierachy. If this gets too cumbersome, a separate 'manager' type class that is responsible for sending and receiving data between the objects it manages can also be a good solution.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Good answer
|
|
|
|
|
I want to retrive data from SQL database using C#.
and i want to put that data in DropDownList.
How can i do this?????
Please Help me.
Thanks In advance.......!!
|
|
|
|
|
and I want to put that data in DropDownlist without using data source
|
|
|
|