Solved

setting the text property of a datagridview combobox column

Posted on 2009-04-04
3
546 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Create XML 5 46
Showdialog 8 29
vb.net 2 37
Help with Query not working in client's PC 1 35
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 …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

895 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now