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 / October 2005

Tip: Looking for answers? Try searching our database.

refer to a field in a table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mpg - 14 Oct 2005 20:09 GMT
i think i FINALLY found the correct group...wooohooo

using vb2005
i drag-dropped a table onto a form, and removed a bunch of fields i didnt
actually need on the form for dataentry.
VB automatically created the add-delete-save buttons on a toolbar.

my problem is, before the data is updated to the actual table, i need to put
values into a few fields that arent on the form itself.
I just cant seem to find how to refer to a field that's part of the table
via the bindng control that VB autmatically creates when i setup a
datasource.

help please
Bart Mermuys - 15 Oct 2005 03:37 GMT
Hi,

>i think i FINALLY found the correct group...wooohooo
>
[quoted text clipped - 8 lines]
> via the bindng control that VB autmatically creates when i setup a
> datasource.

VB should also have created a BindingSource for the table which you can use
to get a DataView or DataRowView from, eg:

Imports System.Data

'
' access the entire table through DataView
'
Dim DataView dv As DataView = DirectCast(
   YourBindingSource.List, DataView)

dv(rownr)("colname") = ...

'
' access current row through DataRowView
'
Dim DataRowView drv As DataRowView = DirectCast(
   YourBindingSource.Current, DataRowView)

drv("colname") = ....

HTH,
Greetings

> help please
mikeslaptop - 15 Oct 2005 03:56 GMT
thanks for the info, but it's rather unintelligable for someone new at this
stuff.
the whole point of using 2005 vb was because i wasnt supposed to have to
manually establish links to datasets

i had 'imagined' something like:
bindingsourcename.fieldname.property=value     but i havent found anything
like it

in your sample, it looks like i have to deternine the row# and i have no
idea of the row# becasue the dataentrysform is creating a NEW record, and
doesnt yet exist in the table, as i understsand it.

are you serious about you example? is there not a more simple way to use the
existing bindingsource to reference the field??

confused....

>> using vb2005
>> i drag-dropped a table onto a form, and removed a bunch of fields i didnt
[quoted text clipped - 32 lines]
>
>> help please
Bart Mermuys - 15 Oct 2005 04:33 GMT
Hi,

> thanks for the info, but it's rather unintelligable for someone new at
> this stuff.
[quoted text clipped - 4 lines]
> bindingsourcename.fieldname.property=value     but i havent found anything
> like it

Technically there is a way to do this but not using that syntax making it
more advanced then what i showed you.

> in your sample, it looks like i have to deternine the row# and i have no
> idea of the row# becasue the dataentrysform is creating a NEW record, and
> doesnt yet exist in the table, as i understsand it.

It may not yet exist in the DataTable it will exist in the DataView and you
don't need to know the row# if you used the second part of code i gave you:

Dim DataRowView drv As DataRowView = DirectCast(
   YourBindingSource.Current, DataRowView)

drv("colname1") = value1
drv("colname2") = value2
...

> are you serious about you example? is there not a more simple way to use
> the existing bindingsource to reference the field??

Not that i know of.

HTH,
Greetings

> confused....
>
[quoted text clipped - 34 lines]
>>
>>> help please
mikeslaptop - 15 Oct 2005 05:24 GMT
hey, thanks again. i shall attempt to implement your code sample.
i really appreciate your help.

> Hi,
>
[quoted text clipped - 71 lines]
>>>
>>>> help please
mikeslaptop - 15 Oct 2005 05:34 GMT
ummmm, sorry for the further bother, but------
i'm suspecting a problem in the syntax
is this spelled right? getting errors.- datarowview not defined

> Dim DataRowView drv As DataRowView = DirectCast(YourBindingSource.Current,
> DataRowView)
Bart Mermuys - 15 Oct 2005 05:52 GMT
Hi,

> ummmm, sorry for the further bother, but------
> i'm suspecting a problem in the syntax
> is this spelled right? getting errors.- datarowview not defined

Put "Imports System.Data" at the top of your file or use
"System.Data.DataRowView".

hth,
greetings

>> Dim DataRowView drv As DataRowView =
>> DirectCast(YourBindingSource.Current, DataRowView)
mikeslaptop - 15 Oct 2005 06:08 GMT
i declared it at the top of one of my modules,
but now am getting new error-  expected end of statement

>>> Dim DataRowView drv As DataRowView =
>>> DirectCast(YourBindingSource.Current, DataRowView)

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.