473,749 Members | 2,492 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 1031
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
1613
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
2704
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
1564
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
2278
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
1701
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
1382
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
2073
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
2179
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
4628
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
1868
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
8996
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
9388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9254
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
8256
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
6800
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
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.