How to show one selected entry of datagridview on separate form in VB .Net?
I want to show sele开发者_开发百科cted entry of DGV on Separate form in VB .Net. When double click on one row of DGV then this row must be open in new form. How can I do it? Can anybody help me?
To launch a new form you will need to do the following in some way:
1) Handle the a double click event in the form. There are a couple of options for this. One way is to handle the CellDoubleClick event, although if you choose this option you may want to set the SelectionMode property of the form to select whole rows at a time rather than just individual cells.
2) Determine the entry that has been double clicked. I don't know if you have a bound set of data objects or not, but you will need to get the data representation of what will be in the new form in some way.
3) Launch your new form. Do this from the event handle. You will need to consider if you want to display it modaly in front of your original form, or whether it should hide the original form. If you want to hide the original form then you will need to need to consider how you can get back to it afterwards etc.
4) Pass your data object to the new form and have a method for displaying it.
I hope that has answered more questions than it raised!
精彩评论