473,699 Members | 2,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i have problem with datagridview need help please

3 New Member
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 1028
spidervb
3 New Member
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
1611
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..... ???? it take about 45 seconds with 2500, i need to put at least 10000 in few seconds ... :( See my code below perhaps you can help ..
16
2701
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
1560
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; int i = 0; int j = 0;
4
2276
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 dataSet updating lark when i realised that i think i am right back at square 1!!! Here's my scenario - i have a SQLDB and i retrieve all my data from that into a dataset and display this to a datagrid(WebForm). I have got this grid sorted and...
10
1697
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 there is possible to do like borland team B did in their news group... Please reply ''YES'' in this thread if you agree with me.... -- :: KHAMAL ::
1
1379
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 when the focus is in the cell (after invalidating) I click anywhere on form (focus still stays in cell) and then press escape .. and the row does not delete itself, it just blanks out. This is wrong behaviour, as it should delete. (which it does...
11
2065
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 I am humbled without fail. This last project was/is especially painful ;) Please visit this site: IdeaMill: tableFilter This demo is a couple of months out of date, unfortunately, but it does demonstrate the specific problem I need your help...
1
2175
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 (LoginName,UserName) 2. the datagridview sorting is set to automatic, so when i click on the column header is sorts well. 3. i put in an event handler for the CellEndEdit Event, so whenever the user of the program changes the content of a cell in the LoginName...
4
4627
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 datagridview. Do I need to convert the datagridview into something else (dataset?) or should I have put the data into a dataset in the first place. Assuming I can create a 'Data Source' from my data, can you advise me on how to launch a report from a...
0
1864
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
8705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8623
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9197
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8941
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8897
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7785
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6549
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.