|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Disable a text box when it's not adding new row?I want to enable a text box only when it's in "add new" status. The
BindingSource.Position just return a number. Any good way to do it? Thanks, Maybe you could enable the TextBox in the BindingSource.AddingNew
event. ============== Clay Burch Syncfusion, Inc. The problem is when to disable the TextBox after adding? It sounds not
proper events of BindingSource suitable. ClayB wrote: Show quote > Maybe you could enable the TextBox in the BindingSource.AddingNew > event. > > ============== > Clay Burch > Syncfusion, Inc. > > How do you *know* it's in AddNew status? When they add a row to the list or
datatable? Or is that what you're asking? Robin S. ------------------------- Show quote "Nick nkw" <nick.y.w***@hotmail.com> wrote in message news:OMnrWdhUHHA.4744@TK2MSFTNGP02.phx.gbl... >I want to enable a text box only when it's in "add new" status. The >BindingSource.Position just return a number. Any good way to do it? > > Thanks, I know one way to tell, check if th position of bindingSource is larger than
the counts of the table. But it seems not work well on multiple users environment. Show quote "RobinS" <RobinS@NoSpam.yah.none> wrote in message news:n76dnexzUJ-eo0vYnZ2dnUVZ_ragnZ2d@comcast.com... > How do you *know* it's in AddNew status? When they add a row to the list > or datatable? Or is that what you're asking? > > Robin S. > ------------------------- > "Nick nkw" <nick.y.w***@hotmail.com> wrote in message > news:OMnrWdhUHHA.4744@TK2MSFTNGP02.phx.gbl... >>I want to enable a text box only when it's in "add new" status. The >>BindingSource.Position just return a number. Any good way to do it? >> >> Thanks, > > Hi,
"Nick nkw" <nick.y.w***@hotmail.com> wrote in message If you are using DataSet/DataTable/DataView as a DataSource for the news:OMnrWdhUHHA.4744@TK2MSFTNGP02.phx.gbl... >I want to enable a text box only when it's in "add new" status. The >BindingSource.Position just return a number. Any good way to do it? BindingSource, then something like this might work: private bindingSource_CurrentChanged(...) { DataRowView drv = (DataRowView)bindingSource.Current; textBox.Enabled = drv.IsNew; } HTH, Greetings Show quote > > Thanks, It really helps to use a New button also, something like the following. But
a better solution is to set up a comprehensive method that includes all buttons and controls that are enabled/disabled as one. Private Sub btnNew_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNew.Click BindingSource.AddNew() txtQuantity.Enabled = true btnNew.Enabled = false btnSave.Enabled = true End Sub Private Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click SaveRoutine() txtQuantity.Enabled = false btnSave.Enabled = false End Sub Show quote "Nick nkw" <nick.y.w***@hotmail.com> wrote in message news:OMnrWdhUHHA.4744@TK2MSFTNGP02.phx.gbl... >I want to enable a text box only when it's in "add new" status. The >BindingSource.Position just return a number. Any good way to do it? > > Thanks, |
|||||||||||||||||||||||