little confused about data grid view
im using the studio.net app
here is the problem:
i need to create 2 forms
1st form is bound to an employee info table
2nd form is unbound and on the form i need it to bring up payroll info from a different table when the user changes the 1st forms selected person
i tried doing it with vb2005 coding and that doesnt work
if anyone can point me in the right direction on how i could make the 2nd form work in conjuction with the 1st form to display the employees payroll amounts that would be great.
thanx in advance.
Daren
Re: little confused about data grid view
http://dotnetperls.com/Content/DataG...-Tutorial.aspx take a look at this tutorial which gives more information about your problem.
Re: little confused about data grid view
If you want more than 1 table viewed in a datagridview all you need to do is create a dataTable that has the tables you want to view.
Then set the datasource of the datagridview to the new dataTable. Of course the tables need to be in the same database.
You can make a new dataTable by double clicking the "DatasetName.xsd" file in your solution explorer window.
Then drag a datatable over from the toolbox and set its configuration to an SQL statement that grabs the data from the tables you want to combine, using either the query builder or a typed out statement.
Just make sure you join the related fields correctly or you'll end up with many duplicate rows of data.
I find it easier to include all fields from the tables I want then exclude unwanted fields in the "columns.collection" option of the datagridview in the properties window.
Example of Joining 2 tables: DataTest = Table 1, tblLogin = Table 2
SELECT DataTest.Username, DataTest.Value1, DataTest.Cleared2, DataTest.Value2, DataTest.value3, DataTest.[Entry Date], DataTest.Total,
DataTest.GrandTotal, tblLogin.LoginID, tblLogin.UserName AS Expr1, tblLogin.[Password], tblLogin.PassPhrase, tblLogin.PassAnswer
FROM DataTest, tblLogin
WHERE DataTest.Username = tblLogin.Username
Hope this helps for allowing DataGridView to show more than 1 table.
Re: little confused about data grid view
Creating a Master/Detail Form Using Two Windows Forms DataGridView Controls
I hope this will help you!