473,382 Members | 1,480 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,382 software developers and data experts.

How to compare the value of DataGridViewComboboxColumn in datagridView

Hi,
My application is in VS2008 coded in Vb.net
I have a datagridView on one of my form.This is filled from the database at the load event of the form.The datagridView also has a column of type DatagridViewComboboxcolumn.
This DatagridViewComboboxcolumn already has 4 values added to it in its collection during design time.My requirement is when the data is loaded in the datagridview, the corresponding record which is supposed to be loaded in DatagridViewComboboxcolumn should compare its value with the value of DatagridViewComboboxcolumn.And if the value matches than that value should get selected in DatagridViewComboboxcolumn.
The database will have the any of the 4 values that are already in DatagridViewComboboxcolumn.It just has to compare both values and select the matching value.
Below is my Code
Expand|Select|Wrap|Line Numbers
  1. query= "Select Record1,Record2,Record3 from TableName"
  2.         cmd = New SqlCommand(query, connection)
  3.         dr = cmd.ExecuteReader()
  4.         If dr.HasRows Then
  5.             While dr.Read()
  6.                 datagridView.rows.add(dr(0),dr(1),dr(2))
  7.              End While
  8.         End If
  9.  
dr(2) is supposed to compare the record with DatagridViewComboboxcolumn.
How can i compare it with the value of my DatagridViewComboboxcolumn of my datagridView
Please suggest.
Sep 15 '11 #1
0 1344

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

Similar topics

1
by: Morten Snedker | last post by:
How do I the value of a cell in a datagridview, before it is updated? I wish to validate the "visible" value, not the actual value (cell/row hasn't been updated yet). Thanks in advance. ...
2
by: deancarstens | last post by:
Hi, I'm a novice with VB and I've written this pretty simple script, but for the life of me, I can't get the last bit of the script to work. It should compare the value entered by the user...
2
by: paolol | last post by:
Hi, I have a datagridview and at the doubleclick event I will like to open a new window with a collection of data from an ADO DB , but I don't know how to get the value of a cell in the clicked...
0
by: pujabebisunar | last post by:
hi can u tell me how can i pass my textbox value into datagridview .i have 3textbox,1add button and 1datagridview
1
by: =?Utf-8?B?QnJpYW5ESA==?= | last post by:
Hi I am looking for examples of how to find the row index in a Datagridview control by comparing a string value to the value in a Cell. Thanks Brian
0
by: isisqiero | last post by:
I use a list of names in a Word document as the value of SELECT statement's parameter. However, my datagridview shows only the column names without the data I am hoping to see. Public Class Form1 ...
1
by: mesut | last post by:
Hi colleagues, In fact I don't have a problem but just don't know which way is good and better. I need some advice which programming way I shall use. Since a couple of days I'm investing my...
1
by: flormarinkovic | last post by:
Good morning, I have resume my old question for the follow: I have shapes in different folders, and i need to check if the field "Codi_bd" and then i have to compare the value of the fields of...
0
by: visweswaran2830 | last post by:
Hi, I am having datagridview in that I have datagridview combobox column and noraml textfield. I want to know that how can I load selected value in that combox box when I am loading all entered...
1
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.