473,398 Members | 2,165 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,398 software developers and data experts.

system.form exeception data gridview combobox cell while inserting data to data grid

I have a data grid view,,in third column of data grid view is combox box,,am filling thise
Expand|Select|Wrap|Line Numbers
  1.  Dim c As DataGridViewComboBoxColumn
  2.             Dim cmd2 As New SqlCommand("select desigID,DName from Designation_tbl where deleted=0", con.connect)
  3.             cmd2.CommandType = CommandType.Text
  4.             Dim objdataadapter As New SqlDataAdapter(cmd2)
  5.             Dim results As New DataSet
  6.  
  7.             objdataadapter.Fill(results, "DesignationMaster_tbl")
  8.             c = DGVEmployee.Columns(3)
  9.             c.DataSource = results.Tables("DesignationMaster_tbl")
  10.             c.ValueMember = "desigID"
  11.             c.DisplayMember = "DName"
  12.             con.disconnect()
after that i want to fill my data grid view..
so i manually created all columns..
then i wrote code like this:
Expand|Select|Wrap|Line Numbers
  1. Dim Ecode As String
  2.             Dim Ename As String
  3.             Dim email As String
  4.             Dim design As String
  5.     Dim cmd As New SqlCommand("  select eCode,eName,desigID from EmployeeMaster_tbl", con.connect)
  6.      dr = cmd.ExecuteReader
  7.             While dr.Read
  8.                 If dr("eCode") Is DBNull.Value Then
  9.                     Ecode = ""
  10.                 Else
  11.                     Ecode = dr("eCode")
  12.                 End If
  13.                 If dr("eName") Is DBNull.Value Then
  14.                     Ename = ""
  15.  
  16.                 Else
  17.                     Ename = dr("eName")
  18.  
  19.                 End If
  20.                 If dr("desigID") Is DBNull.Value Then
  21.                     design = ""
  22.                 Else
  23.                     design = dr("desigID")
  24.                     desgnationname = RecordID_String("DName", "Designation_tbl", "desigID", design)
  25.  
  26.                 End If
  27.      Dim row0 As String() = {Ecode, Ename, email, desgnationname}
  28.     DGVEmployee.Rows.Add(row0)
  29.       End While
but am getting error: system.form exeception data gridview combobox cell
Feb 4 '14 #1
0 1053

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

Similar topics

1
by: sjebaemer | last post by:
how do i get the value of the combobox cell?
4
by: Hans Merkl | last post by:
Hi, Is there a way to show the column headers of a GridView control even if there is no data? The only thing I see is the EmptyDataTemplate but I would also like to display the column headers. ...
1
by: Jon S via DotNetMonster.com | last post by:
HI all, I'm returning a dataset to a gridview control. When the gridview asp.net control is populated from the returning dataset some of the cells remain empty. This is expected as some data...
2
by: loga123 | last post by:
Hi All, I am using Link Button for DELETE on the gridview. When I click on DELETE link, I get the ArgumentOutOfRangeException. But...it deletes the record from table in the database. On...
3
by: Przemek M. Zawada | last post by:
Dear Group, I'm developing sample window form, using DataGridView control, which is filled with data through BindingSource, which is based on type of object, as follow: public sampleClass {...
1
by: sambathrajmca | last post by:
Hai, I am sambath Raj.I am new for you.Now i am trying to use windows forms with data GridView Controll.Now i am adding combobox in that data GridView but defaultly New Row Will be added next to...
2
by: =?Utf-8?B?SmFtZXMgTWFydGlu?= | last post by:
I have a table that I dragged onto a form from a dataset. I changed some of the fields to comboboxes and set the data source, display member (text), and value member (int) to another table within...
2
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi, I've bind a grdiview to a database and it's working fine. but what I want to do is if the data in certain cell exceed the cell width the that cell will only show the words with some dots...
1
by: dotnetnovice | last post by:
Hi everybody... I want to show data in the data gridview placed in my form after getting data from my data access layer class through a class... Here is my code in the data access layer class....
1
by: Beany | last post by:
Morning, at the moment i can change the datagridview combobox cell style using the cellvaluechanged event handler using the following code: Private Sub DataGridView1_CellValueChanged(ByVal...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...
0
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,...

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.