Solved

can i bind a text field to a dataview table field VB.net

Posted on 2004-09-22
3
448 Views
Last Modified: 2006-11-17
Hi

I have a form that has three text fields, a combobox and datagrid.   I have a one to many relationship with the form and the datagrid.  the combobox is used to let the user choice which record they want to look at.  I havetwo data Adapters, one for each table.  A dataset and a relationship, and two dataviews. I am using the rowFilter to populate two dataviews.

Dataview1 is bound to the datagrid. this is good

Can i bound Datagrid2 to the text Fields on my form?

Here is the code that i am trying to use, i get ti error,
Class "System.data.datatable" ca not be indexed because it has no default property

Try
            Dim strLocation As String
           
 'bind the data in the database to the textfields in the form, this doesn't work
            Me.txtAccessID.DataBindings.Add("text", DvTextFields.Table("Accessorie"), "Accessorie_ID")
            Me.rtxtDesc.DataBindings.Add("text", DvTextFields.Table("Accessorie"), "Access_Desc")
            Me.cboAccessType.DataBindings.Add("text", DvTextFields.Table("Accessorie"), "Access_Type")
            Me.txtPrice.DataBindings.Add("text", DvTextFields.Table("Accessorie"), "R_List_Price")
           
 'bind the datagrid to te view, this works
            Me.dgrModels.DataSource = DvDatagrid

        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try

thanks
0
Comment
Question by:Nerdy_Girl88
[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
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
keijerjh earned 500 total points
ID: 12126008
Hi,

I believe you want to create a Master-Detail form?
If so you should create a dataset wich contains the two tables 'Models' and 'Accessorie'.
Create a relation, for example 'fk_Accessorie2Models'.
Bind you masterdata (textboxes) to the DataSet and use the Datamember 'Accessorie' and bind your detail data to
the dataset with the datamember "Accessorie.fk_Accessorie2Models".
Please send the table-design.
Greetings,
Yelle
0
 

Author Comment

by:Nerdy_Girl88
ID: 12127193
Thanks for your help, your right thatswhat i want to do,

here is the table design

Accessory table  (Master,parent)   one to many relationship  Accessory_Model table(child)    

Accessory table
Accessory_ID(PK)
Accssory_Name
Description

Accessory_Model
Accessory_ID(FK)
Mode_ID(FK)

these is also another parent table, i don't need right now
table Model

I also have,
Data Adapters  DaAccessory  and DaAccess_Model
Data Set   DsAccess_Model  with a relationship Access_Model
Data View DvAccessModelDgr DvAccessModelTxT

I am using dataviews, to so i filter the dataset with the selected value from the combobox, and then bind the dataviews to the data fields and data grid,  I was going to use the dataset but, would have have to use a parameterised query to populate the dataset,  Would this be a better way?  Im confused how the parameterised query will work with two data adapters.  Do I need to use the parameter on both adapters or just one?

Currently on the form The datagrid works but the textfields don't work,  How will the dataview effect my save/add/edit button?  I see alot of people have problems with dataviews.  is this your experience?  Do you use dataViews?

is this what your looking for
thanks.

0
 

Author Comment

by:Nerdy_Girl88
ID: 12127516
Turns out I will need that other table

Model
ModelID(PK)
Model_Name
Model_Desc

The data grid will hold the Access_Model table details,  I want to the Access_Model.ModelID to be a dropdown box in my datagrid.  I want the Access_Model.AccessoryID to be populated with the parent PK(Accesory.AccessoryID) and the Access_Model.ModelID to be a list of Models from the Model table.

I know this is asking alot,  so if you know of any links to a tutorial explaining how this could be done that would be great.

my back ground is VBA,  VB.net is so different......it take so long to do anything.
thanks again.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
A short article about problems I had with the new location API and permissions in Marshmallow
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

751 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