Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2004-09-22
3
Medium Priority
?
461 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 1000 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

Independent Software Vendors: 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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Progress

688 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