473,320 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

i have problem with datagridview need help please

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
1 1019
thanx i resolved the problem by myself
Sep 26 '13 #2

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

Similar topics

6
by: João Santa Bárbara | last post by:
Hi all i have a datatable with 2500 records, and i want to fill a listview, my problem is that it take too much time to load them all. is anytihing i could do to improve my performançe..... ????...
16
by: t_pantel | last post by:
I 've got the following structure: typedef struct GROUPED { short val ; short code; short group; short forecast_cd; short double_ind; short min;
5
by: cpptutor2000 | last post by:
I am compiling and running the following code snippet on a Linux box - I am really puzzled by the answers. Could someone please tell me what might be wrong? void test(){ int m = 0; int n = 0;...
4
by: steroche | last post by:
I would REALLY appreciate help please please please! Im sure it is probably blindingly obvious to most of you but I am totally in the dark here!I am lost - i thought i had finally figured out this...
10
by: Khamal | last post by:
Hello... The quality of reply is quite bad in this forum.....many post has not reply.... I/We need Microsoft technical team involve directly in this forum and put some effort to give us HELP. If...
1
by: Asif Mohammed | last post by:
Hello, I have a databound datagridview, its allowed to add,remove and edit I type a value in (in new row), it uses e.cancel = true to invalidate the cell .. and does not let focus go away, but...
11
by: Daemach | last post by:
OK, it's time to try the experts :) I've been doing most of my development work in Firefox because of Firebug. Then, when my projects are fully debugged, sleek and refined I load them in IE and...
1
by: Ahmed Yasser | last post by:
Hi all, i have a problem with the datagridview sorting, the problem is a bit complicated so i hope i can describe in the following steps: 1. i have a datagridview with two columns...
4
by: Peter Forman | last post by:
I have a windows form that contains a datagridview containing manipulated data from various sources (numerous sql servers + xml files). I now need to create a report from the data in the...
0
by: Steve K | last post by:
to this newline when an enter key is detected. Update: I tried adding this code: <code> public PMDDataGridViewTextBoxEditingControl() :base() { this.Multiline = true; } </code>
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.