Cheers to my first 6hours of coding ... but that's the catch when you start (or start over) ... you get stuck with silly problems:

I have created a DataGrid with a DataSet from a search result class-

Now I've added a button in my rows to get a new form with the details of that element:

private void dgSearchResult_ItemCommand(object sender, DataGridCommandEventArgs e)
switch (e.CommandName)
case "ViewItem":
private void ViewItem(DataGridCommandEventArgs e)
// to get the new form with the details of the row e

Now 2 things :
- 1st the silliest : What is the command to post a new form? It's kinda silly that I get that far but I can't change the form...
-2nd : I've been looking around to create that eventHandler ItemCommand and I stumbled accross this variation

switch (((LinkButton)e.CommandSource).CommandName)
//or I thought in my case
switch (((PushButton)e.CommandSource).CommandName)

and I couldn't find anything for that LinkButton Cast...
I finally just removed the whole thing and tried with just e.CommandName and it worked.
Is that ok (seems to work fine but I wonder if it is the proper way) or will I get unexpected behaviours?

Thank you for your help and patience

11 Years
Discussion Span
Last Post by alc6379

I'm not entirely sure on too many of the points of your question, but I do at least know that to show a form, you simply use the Show() method.

Form e = new Form();

Simple as that. Does that help any?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.