Solved

setting the text property of a datagridview combobox column

Posted on 2009-04-04
3
575 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

752 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