Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / September 2006

Tip: Looking for answers? Try searching our database.

datagridview tag value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jvCoach - 25 Sep 2006 13:05 GMT
I'm working with vb.net 2005.

I have a class that i've loaded up with my data. Then created a datasource
off the class. I load up the datagridview with data from a class.. all this
is working fine. I've got data.

My problem is with the tag on the datagridview. I've gone in and bound it to
the column in the datasource taht I want (i've done it like this before)

when i create the double click event on the datagridview, in other code i've
been able to do a datagridview.tag and get the value of column and row that
i've double clicked on. I can't figure it out why it's giving me a value =
nothing instead.

there must be something that I'm forgetting because like I said.. i've done
this before...

hopefully someone can help.
Here is what I'm doing to load up the datagridview with data...

With oBuildingUtils
           .LoadFromDB()
       End With

       With oBuildings
           oBuildings = oBuildingUtils.Load("")
       End With        Me.BuildingDataGridView.DataSource = oBuildings

Like i mention above.. this part is working.. just not when i double click
on the datagridview.
thanks
shannon
jvCoach - 25 Sep 2006 13:56 GMT
If i do a
me.ComputerNameDataGridView.Rows(me.ComputerNameDatagridView.CurrentRow.Index).Cells(1).value

i get the value i want.. but using the tag has worked for me in the past but
i'm just not getting something... hopefully someone out there can tell me
what I've forgotten.

Thanks
Shannon

> I'm working with vb.net 2005.
>
[quoted text clipped - 29 lines]
> thanks
> shannon
Bart Mermuys - 25 Sep 2006 16:06 GMT
Hi,

> I'm working with vb.net 2005.
>
[quoted text clipped - 27 lines]
> Like i mention above.. this part is working.. just not when i double click
> on the datagridview.

The above code only shows the binding of the new DataSource to the
DataGridView, but you also need to bind the new DataSource to the Tag
property. .

A better option is probely using a BindingSource.  Create a DataSource for
your Building class, from the DataSources Window drag the Building
DataSource on the Form and it will create a BuildingDataGridView and also a
BuildingBindingSource, then bind the DataGridView's Tag property to the
BuildingBindingSource.

Then in code you would only need to change the DataSource of the
BindingSource:

With oBuildingUtils
   .LoadFromDB()
   oBuildings = .Load("")
End With
BuildingBindingSource.DataSource = oBuildings

HTH,
Greetings

> thanks
> shannon
jvCoach - 25 Sep 2006 16:43 GMT
thanks a million.. that fixed it..

> Hi,
>
[quoted text clipped - 54 lines]
>> thanks
>> shannon

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.