Hi,
i have two tables with this data:
1-Managements
Manag_ID , int
Manag_Name , nvarchar(150)
2-Departments
Dept_ID , int
Dept_Manage_ID , int
Dept_Name , nvarchar(150)
and this my code
Expand|Select|Wrap|Line Numbers
- Private Sub FillDataGrid()
- DG.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
- DG.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
- WinClass.FillDataGrid(DG, " select * from Departments ")
- DG.Columns(0).HeaderText = "Dept_ID"
- DG.Columns(0).Visible = False
- 'DG.Rows(0).Visible = False
- DG.Columns(1).HeaderText = "Manage of department"
- DG.Columns(1).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
- DG.Columns(2).HeaderText = "Department name"
- DG.Columns(2).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
- End Sub
- .................................................
- Private Sub DG_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DG.CellClick
- If e.RowIndex >= 0 Then
- TxtID.Text = DG(0, e.RowIndex).Value
- CboManag_Name.SelectedValue = DG(1, e.RowIndex).Value
- TxtDept_Name.Text = DG(2, e.RowIndex).Value
- End If
- End Sub
my datagridview show the manage_name as number
i want the datagridview show data of table manages
like this
Expand|Select|Wrap|Line Numbers
- Manage of department Deparments
- 1 Mechanical
- 4 Electrical
- 8 Auto
thanks