Windows Vista
Windows Live
Game Technologies
VS Express Editions
Visual Studio
SQL Server
Windows Forms
Visual C++
Microsoft ISV
Visual C#
Smart Device
.NET Development
VS Team System
Visual FoxPro
Architecture
Software Development Network>> Windows Forms>> How To Get Grid Current Cell Text
How To Get Grid Current Cell Text
Hot Topic
use image as ColumnHeader in ListView
System.Web.Mail
A question regarding inheritance and interace implementation
removing scroll from a Form
C# question
DataGridView
MDI Menu Merging Problems
Problem with Minimizing both Forms
Outlook 2003 Clone - Owner Drawn background Color problem
Showing property values as dropdownlist
Windows Forms
VS.NET: significance of reference name capitalization
Reference to assembly not working
Drawing see-thru shadows
Open hlp File from VB6 application
Creating a Small App to check which version of .NET framework is installed
Any shortcut to passing a form as an argument?
Loading application efficiently
Textbox bound to a decimal type will hang the form if non-numeric data is entered
Inheriting Designer
Case sensitive Spell Check Component for .NET
How To Get Grid Current Cell Text
How can I get the DataGridView cell contents in the Current Row Column 1
I tried this but it doesnt work
TextBox1.Text = CType(ProductsDataGridView.CurrentCell.RowIndex, String) & CType(ProductsDataGridView.Columns(1), String)
Answer this question
How To Get Grid Current Cell Text
Dave DeJonge
What's bound to your datagrid If the grid is bound directly to a table then this code works. If you're bound to some other datasource you may have to adjust the type that bmb.current gets converted to.
YuvalO
I get an error at DataRowView
Do you think you could take another look -- Thanks
WillfinDavid
Wouldn't ...
ProductsDataGridView.Rows[ProductsDataGridView.CurrentCell.RowIndex].Cells[0].Value;
work
Vitoto
One option would be:
Dim bmb As BindingManagerBase = Me.BindingContext(ProductsDataGridView.DataSource, ProductsDataGridView.DataMember)
TextBox1.Text = CType(bmb.Current, DataRowView).Item(0)
Item(0) is the first column as the column numbering is 0 based. If you wanted the value at the second column you would use Item(1).
How To Get Grid Current Cell Text
Answer this question
How To Get Grid Current Cell Text
Dave DeJonge
YuvalO
Do you think you could take another look -- Thanks
WillfinDavid
ProductsDataGridView.Rows[ProductsDataGridView.CurrentCell.RowIndex].Cells[0].Value;
work
Vitoto
Dim bmb As BindingManagerBase = Me.BindingContext(ProductsDataGridView.DataSource, ProductsDataGridView.DataMember)
TextBox1.Text = CType(bmb.Current, DataRowView).Item(0)
Item(0) is the first column as the column numbering is 0 based. If you wanted the value at the second column you would use Item(1).