Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

setting the text property of a datagridview combobox column

Posted on 2009-04-04
3
Medium Priority
?
590 Views
Last Modified: 2012-06-27
I am working on a windows application using vb.net. I have a datagrid view on the form..the user can eneter the details in the grid and  submit it....and he can also retrieve the valuse by searching with a specific Field (say ID No)...
so what i want is....how can i set the display  text property of the combobox column ...if that is a textbox, which is not in the datagrid view, i simply would have said

textbox1.Text = abc...
0
Comment
Question by:yuvaratna
3 Comments
 
LVL 18

Expert Comment

by:carlnorrbom
ID: 24071145
Hi,

If you just want to display a certain value it's as simple as:

DataGridView1.Rows(0).Cells("YourColumnName").Value = "Text to display"
0
 

Author Comment

by:yuvaratna
ID: 24072810
i  tried this , but it is throwing an error..Please find the error attached.....

system.argumentexception:DataGridViewcombobox cell value is not valid

I wanted to assign the value in  the database to the respective column of the datagridview, when the user searches for a particular record


Untitled.jpg
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 2000 total points
ID: 24073025
I think this is the same problem of other question and this should do:
        For Each row As DataGridViewRow In Me.DataGridView1.Rows
            If Not row.IsNewRow Then
                row.Cells(0).Value = "1"
            End If
        Next
 
        ' Where "1" is the name of the item to select 

Open in new window

0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question