From: Jeff B on
Hi All,

Just wondering if someone could tell me why when i run the form that the
three text boxes that i have that I have bound to a Beds Table I can not get
to start with the text box empty? no matter what I try they always start
with a value showing. I have tried (as you can see in the code)
txtbox.clear() but that does not seem to do anything, I have tried
textbox.text = "" after the data binding but that does not work?

My Problem controls are txtBedType, txtWeekdayRate, txtWeekendRate
Any Suggestions?

Thanks very much for the help,


Private Sub RoomsForm_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ARoomsBedsDataTier = New RoomsBedsDataTier
ACottagesDataSet = ARoomsBedsDataTier.GetCottageDataSet

ARoomsBindingSource = New BindingSource
ABedsBindingSource = New BindingSource

With ARoomsBindingSource
.DataSource = ACottagesDataSet
.DataMember = "Rooms"
.Sort = "Bedcode"
End With

With cboRooms
.DataSource = ARoomsBindingSource
.DisplayMember = "Room"
.ValueMember = "BedCode"
'.DataBindings.Add("text", ARoomsBindingSource, "Room", False,
DataSourceUpdateMode.Never) Commented out starts box empty
.SelectedIndex = -1

End With
With ABedsBindingSource
.DataSource = ACottagesDataSet
.DataMember = "Beds"
.Sort = "BedCode"
End With

txtBedType.DataBindings.Add("text", ABedsBindingSource, "BedType",
True, DataSourceUpdateMode.Never, Nothing)
txtWeekdayRate.DataBindings.Add("text", ABedsBindingSource,
"WeekdayRate", True, DataSourceUpdateMode.Never, Nothing, "c2")
txtWeekendRate.DataBindings.Add("text", ABedsBindingSource,
"WeekendRate", True, DataSourceUpdateMode.Never, Nothing, "c2")
chkJacuzzi.DataBindings.Add("CheckState", ARoomsBindingSource,
"Jacuzzi", True)
chkPrivateAccess.DataBindings.Add("CheckState", ARoomsBindingSource,
"Private Access", True)
chkFireplace.DataBindings.Add("CheckState", ARoomsBindingSource,
"FirePlace", True)


End Sub

Private Sub cboRooms_SelectionChangeCommitted(ByVal sender As Object,
ByVal e As System.EventArgs) Handles cboRooms.SelectionChangeCommitted

strBedCode = cboRooms.SelectedValue.ToString
ABedsBindingSource.Filter = "bedCode = '" & strBedCode & " ' "

End Sub