Please be specific. in what format do you want to pass the data? are you gonna store them in local variables or you want to pass them into a form control? one way could be to make a method in the other form and pass the arguments which you need to it, then update whatever you want to update in the next form or just pass it with reference
My EditStudent is my second form which has textboxes for editing. The primary key(student number), which is the cells to be pass to my textbox1 in second form. My textbox1 in the second is disabled.
public EditStudent(string srno)
textBox1.Text = srno;
Then I use a sql select statement to populate the other textboxes for editing.
SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM Student WHERE Student_No = '"+textBox1.Text+"'", con);
DataTable dt = new DataTable();
dt = ds.Tables;
if (dt.Rows.Count > 0)
textBox2.Text = dt.Rows["Last_Name"].ToString();
textBox3.Text = dt.Rows["First_Name"].ToString();
comboBox1.SelectedItem = dt.Rows["Department"].ToString();
comboBox2.SelectedItem = dt.Rows["Course"].ToString();
textBox4.Text = dt.Rows["Address"].ToString();
textBox5.Text = dt.Rows["Contact_No"].ToString();
Do you think this is a good or maybe a fair approach?
personally its good, as long as it works and doesnt violate any security / code quality. you know what they say about coding bra, there can only be standards but there arent any rules as to how you should do something. goodluck with your code. if you got any question feel free to post them here for some comments.
The first method works great for strings because virtually every data type has a .ToString() method. Many of the other possible conversions, however, do require the 2nd option :)
I'm not specifically seeing the variable conversion that's causing your issue based on the source code you provided so I can't give a specific example to match the error (I could just be missing it) but I hope this helps :)