By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 910 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

i have problem with datagridview need help please

P: 3
i have problem with datagridview need help please
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
  1. Private Sub FillDataGrid()
  2. DG.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  3.  
  4. DG.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
  5.  
  6. WinClass.FillDataGrid(DG, " select * from Departments ")
  7.         DG.Columns(0).HeaderText = "Dept_ID"
  8.         DG.Columns(0).Visible = False
  9.         'DG.Rows(0).Visible = False
  10.         DG.Columns(1).HeaderText = "Manage of department"
  11.         DG.Columns(1).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
  12.         DG.Columns(2).HeaderText = "Department name"
  13.         DG.Columns(2).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
  14.     End Sub
  15. .................................................
  16. Private Sub DG_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DG.CellClick
  17.  
  18.  
  19. If e.RowIndex >= 0 Then          
  20. TxtID.Text = DG(0, e.RowIndex).Value
  21. CboManag_Name.SelectedValue = DG(1, e.RowIndex).Value
  22. TxtDept_Name.Text = DG(2, e.RowIndex).Value
  23.  
  24. End If
  25.  
  26. End Sub
my question is
my datagridview show the manage_name as number
i want the datagridview show data of table manages
like this
Expand|Select|Wrap|Line Numbers
  1. Manage of department             Deparments
  2. 1                                  Mechanical
  3. 4                                  Electrical
  4. 8                                  Auto


thanks
Sep 26 '13 #1
Share this Question
Share on Google+
1 Reply


P: 3
thanx i resolved the problem by myself
Sep 26 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.