Connecting Tech Pros Worldwide Help | Site Map

master detail in textbox control

Newbie
 
Join Date: Sep 2009
Posts: 2
#1: Sep 15 '09
Is it feasible to do master detail in textbox control? If I do it with datagridview control, I have no problem. However, when I tried to use textbox control, I had running error. I have googled it for a month and don't see anybody dealing with this questions so hope somebody can give me a definite answer. Maybe it's not possible to use textbox control at all. Ben
tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,743
#2: Sep 15 '09

re: master detail in textbox control


Quote:
s it feasible to do master detail in textbox control?
What do you mean by "master detail"?
Quote:
I had running error.
Could you please provide the relevant code and description of the error?
Newbie
 
Join Date: Sep 2009
Posts: 2
#3: Sep 16 '09

re: master detail in textbox control


I'm using strong typed dataset.

The problem ties with datarelation string "BGHuntedBGHarvest." The "KillNo" is one data field in detail datatable. If I remove the binding, the error will show next data field. The error will be gone until I remove all data fields that not in the datarelation columns. Thanks. Ben

This is error message:
************************************************** **************************

BGHarvestBindingSource.DataMember = "BGHuntedBGHarvest"

Cannot bind to the property or column KillNo on the DataSource.
Parameter name: dataMember
************************************************** **************************
Here is the code:
Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.  
  3.     Private Sub BGHuntedBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BGHuntedBindingNavigatorSaveItem.Click
  4.         Me.Validate()
  5.         Me.BGHuntedBindingSource.EndEdit()
  6.         Me.BGHuntedTableAdapter.Update(Me.WL_TECHDataSet.BGHunted)
  7.  
  8.     End Sub
  9.  
  10.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  11.         'TODO: This line of code loads data into the '_WL_TECHDataSet.BGHarvest' table. You can move, or remove it, as needed.
  12.         Me.BGHarvestTableAdapter.Fill(Me._WL_TECHDataSet.BGHarvest)
  13.         'TODO: This line of code loads data into the '_WL_TECHDataSet.BGHunted' table. You can move, or remove it, as needed.
  14.         Me.BGHuntedTableAdapter.Fill(Me._WL_TECHDataSet.BGHunted)
  15.         Dim MasterColumn() As DataColumn
  16.         Dim DetailColumn() As DataColumn
  17.         MasterColumn = New DataColumn() {_WL_TECHDataSet.BGHunted.Columns("HuntingSeason"), _
  18.             Me._WL_TECHDataSet.BGHunted.Columns("SeqNo"), _
  19.             Me._WL_TECHDataSet.BGHunted.Columns("ShortName"), _
  20.             Me._WL_TECHDataSet.BGHunted.Columns("CountyCode")}
  21.  
  22.         DetailColumn = New DataColumn() {Me._WL_TECHDataSet.BGHarvest.Columns("HuntingSeason"), _
  23.             Me._WL_TECHDataSet.BGHarvest.Columns("SeqNo"), _
  24.             Me._WL_TECHDataSet.BGHarvest.Columns("ShortName"), _
  25.             Me._WL_TECHDataSet.BGHarvest.Columns("CountyCode")}
  26.  
  27.  
  28.         'Me.Big_Game_Harvest_SurveyDataSet.Relations.Clear()
  29.         Dim relation As New DataRelation("BGHuntedBGHarvest", MasterColumn, DetailColumn, False)
  30.         Me._WL_TECHDataSet.Relations.Add(relation)
  31.         BGHuntedBindingSource.DataSource = Me._WL_TECHDataSet.BGHunted
  32.         BGHarvestBindingSource.DataSource = BGHuntedBindingSource
  33.         BGHarvestBindingSource.DataMember = "BGHuntedBGHarvest"
  34.  
  35.     End Sub
  36. End Class
{email address removed}
tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,743
#4: Sep 16 '09

re: master detail in textbox control


TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.
Reply