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":
ViewItem(e);
break;
default:
break;
}
}
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

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();
e.Show();

Simple as that. Does that help any?

This article has been dead for over six months. Start a new discussion instead.