Mar 14th, 2012, 12:03 AM
Ask how to use variables of different Form and click on Datagridview ?
Please help me your questions in this forum.
I have a database table QL include "nhanvien" has two columns that "manv" and "tennv". I have created the connection string, has created a module and connect the function declaration truyvan (sql, dt) with the string sql contains sql query and dt is the datatable has no table variable into.
I have programmed so that when clicking on a line on the datagridview then it will display information on the second textbox above.
Specifically, a form of this child, and it is named Form1, the name of the textbox and label gridview like standing next to it. Formload event is to transfer all data in the table "nhanvien" of the database to gridview.
Now I have a form like this Form2 A:
Now is when you want to type a "matim" to look above, then click "earn airtime" it will open Form1 and also in gridview are selected in line with "manv" to be searched, and the display data up 2 textbox, then the risk of course.
Hey is not required for access to the variables of Form1 and how to select a row in datagridview of Form1. You're stuck, do not know how? I hope you teach with. I get the gridview lines and to run all the code line to check whether there is any code similar to the code are not but then looking back to handle in that box of form1 datagridview on the subject.
Here is the Project and to the folder you create database command, create tables, insert data into the table to help you add high a player. I thank a lot ...
Dim line As Integer = Form1.data_dulieu.RowCount
My english is not very good description should be much less clear
p / s: I use VB.Net 2008 and SQL2008.
Click Here to Expand Forum to Full Width