|
u can access cell value by writing sth. like following
datagrid1.rows[i].itemarray(i).text
where itemarray represents the columns
|
|
|
|
|
I created an array list and added items to it.
When i search for items, i use the Enumerator.
When i find some items, i actually want to either remove or update the values. How would i do that if i am in an Enumerator loop
like
myEnumerator.Reset();
while (myEnumerator.MoveNext())
{
//found the item
//need to update the item, or remove
}
|
|
|
|
|
You will not be allowed to delete an item in an enumarator. You will have to loop through an instance of the arraylist and delete the item in the list
foreach (string s in new ArrayList(alData))<br />
{<br />
if (s == strSearchData)<br />
alData.Remove(s);<br />
}
|
|
|
|
|
Thanks,
how would i replace an element in the list... i do not see a function to replace in the array list.
|
|
|
|
|
foreach (string s in new ArrayList(alData))
{
if (s == strSearchData)
alData.Remove(s);
if (s == strFindData)
alData[alData.IndexOf(s)] = strReplaceData;
}
|
|
|
|
|
One thing you should watch out for is that changing the size of the list during a foreach() call will throw an exception.
So make sure that you don't add or remove items during enumeration. Find the items you want to operate on, save references to them (or their indices) and call the appropriate methods after the loop finishes.
|
|
|
|
|
I placed a gif file in my form,But its not animating
how can i do this?
My small attempt...
|
|
|
|
|
|
I have a gif file, can i place that in grid? i want to see the animation also
i tried with picturebox but no effect
My small attempt...
|
|
|
|
|
Greets all
Can anyone tell me how to apply the SeDenyInteractiveLogonRight right to an account in C#, preferably using the DirectoryEntry class?
Thanks
ccitt
|
|
|
|
|
Hello. I'm having a problem with Remoting.
I have remotable object that has a list of messages (arraylist with strings). That class is in a DLL file.
I have an application that uses that class. In some parts of the code, I add messages to the list.
Finally, I have another application where I want to show the messages. I receive the message using remoting, but the object comes without any message. The list is empty.
What can be happening?
Regards,
Diego F.
|
|
|
|
|
Hi,
I want my application to process multiple files, which it shall receive via the Windows-Explorer context menu entry "Open with...". I checked the command-line arguments, but the string[] has always just a length of 1 and string[0] only contains the first of all selected filenames.
How can I get all filenames which were selected when "Open with..." was clicked?
Thanks in advance,
Alex
|
|
|
|
|
To go more into detail: Am I right that I have to look for the selected filenames in the command line parameters?
Hasn´t anybody an idea? I don´t think that I am the only one who wants to receive multiple files using command line parameters...
|
|
|
|
|
Hi,
FYI: I have an "Open with myprog" added to the Explorer's context menu
(installed by adding some registry entries).
When I select two files in Explorer and apply "Open with myprog", Explorer
calls my program twice, once for each file (rather than once with a list of files).
|
|
|
|
|
Hm, thanks for this info, I already assumed that. I blocked opening multiple instances of my program the following way:
public static void Main(string[] args)
{
Process[] processes = Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName);
if (processes.GetLength(0) > 1)
{
IntPtr hwnd;
if (processes[0].MainWindowHandle == Process.GetCurrentProcess().MainWindowHandle)
hwnd = processes[1].MainWindowHandle;
else
hwnd = processes[0].MainWindowHandle;
if (IsIconic(hwnd) == true)
ShowWindow(hwnd, 9);
else
SetForegroundWindow(hwnd);
}
else
{
Application.Run(new myApp(args));
}
}
Do you know a way to send the new args to the previous instance from which I have the handle? Or is there another common method to solve this problem?
|
|
|
|
|
Hi,
my app is singleton too. It is based on a mutex, not process names.
a second (third) instance sends its command line to the original instance,
using named pipes (and several P/Invoke calls).
(actually I believe the singleton behavior could now be based on the result of
CreateNamedPipe rather than a separate mutex).
BTW an earlier version used sockets to send the cmd line, but that kept
triggering my FireWall (McAfee).
|
|
|
|
|
In my project I have been working on a class that will extract files from a zip, then import all data in those files using SQLBulkCopy into the database. While importing the data I need to know the Information about that particular file(Name, Count\Index). So to do this I need to use events. I have been working at this, got my properties, delegate and event written. All seems to be good, then I try to use the event and I ran into some snags. It turns out that I don't have anything assigned to handle OnImportFile. Below is my delegate and event in my class.
public delegate void GNISImportFileEventHandler(object sender, ImportFileEventArgs e);
public event GNISImportFileEventHandler OnImportFile;
So to assign something on handle OnImportFile I have this:
OnImportFile += new GNISImportFileEventHandler(OnImportFile);
From the articles I have been reading this is the correct way to set something to handle my event, but I get the exception "Delegate to an instance method cannot have null 'this'." Any suggestions or an article that covers this issue would be greatly appreciated. Cheers
|
|
|
|
|
I think any msdn article on event handlers should help you out. But from the code it looks like you are trying to assign the event itself as the handler. Normally you would write a method which has the same signture as your delegate. That method will be your event handler. Something like
public delegate void GNISImportFileEventHandler(object sender, ImportFileEventArgs e);<br />
public event GNISImportFileEventHandler OnImportFile;<br />
<br />
public void myGNISImportFileEventHandler(object sender, ImportFileEventArgs e)<br />
{<br />
}
And you would add the handler like:
myObj.OnImportFile += new GNISImportFileEventHandler(myGNISImportFileEventHandler);
modified: added "myObj." Assuming myObj is the object of your ImportFile class. It could be this. if you are adding it to the same object (which is really not needed since you can just call the method directly..
|
|
|
|
|
Thank you very much for your reply I can now use my event, I understand where I went wrong - I can't use the event as the handler. Thank you very much. One more question for you, How would I use this on a form outside of the class(in a different project) but in the same solution.
|
|
|
|
|
Just add a reference to this project from the other project. (right click on project- add reference..)
|
|
|
|
|
Hi,
I am using TreeView control in C# form application.
This contains no. of nodes and their child node. I want to traverse entire tree view and edit some properties dynamically.
What is the method in C# to traverse TreeView?
Thanks.
Gajesh
|
|
|
|
|
You will have to write a recursive function to traverse all the nodes in a tree view.
|
|
|
|
|
Hi all
i got an html table in an aspx page and i need to parse data from each td and save to database. Any ideas!!!!
|
|
|
|
|
Repost
Sincerely,
Elina
Life is great!!!
Enjoy every moment of it!
|
|
|
|
|
If you are asking how to get the text out of the TD, then use the innertext property of the TD. Make the TD "runat=server" and give it an ID.
|
|
|
|