Question how to set selected grid row as default row for storing data from other forms

grabbetje

New member
Joined
Feb 23, 2015
Messages
4
Programming Experience
Beginner
Hi there,
Im a beginner in vb.net. I have a issue that i can't resolve even after extensive search on the internet.

In programming a mysql driven application witch gathers information from several other forms i have created. Im able to save the data to the mysql database, but when opening a new form, the data saved here is not updating the selected grid row, but is saved as a new row in the database.

Could you please explain to me how to make a selected grid row the master row for all the forms that wil be opened afterwards en how to fill these forms also when the according grid is selected to change something. So to be clear the grid shows not all the info but should me the master for all the forms behind it.

Maybe for you a very simple question, for me a brain cracker for the last 3 weeks.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,350
Location
Sydney, Australia
Programming Experience
10+
I'm afraid that your question doesn't really make sense to me. Apart from anything else, there is no way to make a grid row the default for anything. If you want to use the data from a particular row then you need to get data from that row and use it.
 

grabbetje

New member
Joined
Feb 23, 2015
Messages
4
Programming Experience
Beginner
Thank you jmcilhinney for your reply. what would then be the most appropriate way to store data entered in several forms into the a database keeping everything together. for instance: i have created a editable gridview with devexpress. in here i have created an unique id and name and addres textfields. Then there is a button to open form2 entering specific data like age, gender etc. my problem is that i dont know how to keep data together as in my situation the data entered in form2 is not saved into 'selected' the row of form1 but is saved into a new row with a new unique id generated by MySql leaving the fields of form1in the table empty. Or should i do this by saving the data of every new form into a new table and then link them one way or another. Im sorry as this may seem a stupid question for you, but im struggeling with this for weeks now getting a bit fustrated as i have to finisch this for work. Thanks for your reply
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,350
Location
Sydney, Australia
Programming Experience
10+
my problem is that i dont know how to keep data together as in my situation the data entered in form2 is not saved into 'selected' the row of form1 but is saved into a new row with a new unique id generated by MySql leaving the fields of form1in the table empty.

If that's what's happening then it's because that's what you're doing. If you don't want to add the data to a new row then don't. If you want to add the data to an existing row then do that. I'm not familiar with that particular control but it will provide some way to access an existing row. Use it to get the row you want and then add the data to that. If you were using a DataGridView then you could use the CurrentRow property. Your control may have the same or similar property.
 
Top Bottom