Solved

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

Posted on 2004-09-22
3
440 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
  • 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
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 …

762 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now