|
-
Jul 30th, 2010, 02:26 PM
#1
Thread Starter
New Member
Passing current record
Hi,
I am returning to programming after a long absence (last real work done in VB5.0). I'm trying to do a small customer management project. I'm starting off with a DataGridView on one form showing a reduced number of fields. When the customer is selected a second form gives the full details.
I struggling to find a clean way of passing the selected record to the second form.
Both forms are using the same dataset.
Any ideas (I know it's probably too easy, I spent too many with GW and Quick basic).
Regards
Luke
-
Jul 30th, 2010, 03:56 PM
#2
Member
Re: Passing current record
I think that I developed something what you can use.
Take this code on this adress.
https://www.planetsourcecode.com/vb/...7492&lngWId=10
-
Jul 30th, 2010, 04:01 PM
#3
Fanatic Member
Re: Passing current record
write a Public Sub New(ByRef dgvi As DataGridViewItem) on your second form with a DataGridViewItem(?) object to pass.
Then, just pass the selected datagridviewitem from the datagridview, and then extract the appropriate information from the appropriate columns/field/index.
Then when you want to launch the form, do:
Dim frm as New Form(DataGridView.SelectedItems(0))
I may be totally wrong, but I think if you pass it byref it will update the datagridview as well.
I may be wrong on that tho.
Last edited by Seraph; Jul 30th, 2010 at 04:06 PM.
Visual Studio 2010 Professional | .NET Framework 4.0 | Windows 7
SERYSOFT.COM :: SysPad - Folder Management Program - Please comment HERE if you find this program useful, have ideas, or know of any bugs.
[Very useful for IT/DP departments where many folders are consistently accessed. Also contains a scratchpad window for quick access to notes.]
[.NET and MySQL Quick Guide]
-
Jul 31st, 2010, 12:48 AM
#4
Re: Passing current record
Follow the CodeBank link in my signature and check out my thread entitled Update Grid Row in Dialogue
Last edited by jmcilhinney; Jul 31st, 2010 at 12:51 AM.
-
Jul 31st, 2010, 12:50 AM
#5
Re: Passing current record
 Originally Posted by Seraph
I may be totally wrong, but I think if you pass it byref it will update the datagridview as well.
I may be wrong on that tho.
That would only be true if the type of the parameter was a value type. In this case it's a reference type, so you would only need to pass by reference if you intended to assign a new object to the parameter within the method.
-
Aug 1st, 2010, 03:31 AM
#6
Thread Starter
New Member
Re: Passing current record
 Originally Posted by jmcilhinney
Follow the CodeBank link in my signature and check out my thread entitled Update Grid Row in Dialogue
Just the ticket, many thanks for the suggestions.
Regards
Luke
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|