null in textbox

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

Hello,
a small problem. In a bound textbox I delete the contents and when I go to
another control de text reappears. No events and so on. The db column
accepts null. If the textbox is empty and I put something in, or change
something, no problem. Someone else had the same problem (read in some
newsgroup) and solved it because his databinding was screwy, no further
explanation. I use this (shortened version):

Dim kol As DataColumn
for each kol in ds.tables(0).columns
objNew = New TextboxUser(kol) (my own userclass, inherits textbox)
objNew.databindings.add("Text", ds.Tables(0), kol.ColumnName)
next
myCM = CType(Me.BindingContext(ds.Tables(0)), CurrencyManager)

Please advice
Thanks
Frank
 
Frank said:
Hello,
a small problem. In a bound textbox I delete the contents and when I go to
another control de text reappears. No events and so on. The db column
accepts null. If the textbox is empty and I put something in, or change
something, no problem. Someone else had the same problem (read in some
newsgroup) and solved it because his databinding was screwy, no further
explanation. I use this (shortened version):

Dim kol As DataColumn
for each kol in ds.tables(0).columns

kol.AllowDBNull = true
 
Hi Frank,

I misreaded your question.
Dim kol As DataColumn
for each kol in ds.tables(0).columns
objNew = New TextboxUser(kol) (my own userclass, inherits textbox)
objNew.databindings.add("Text", ds.Tables(0), kol.ColumnName)
next
myCM = CType(Me.BindingContext(ds.Tables(0)), CurrencyManager)

Why is that objNew = New TextboxUser(kol)
I assume you want to set the databindings to an existing textbox so I would
expect something as
dim objNew as Textbox = TextboxUser(kol)

Just guessing I see to few now,

Cor
 
Cor Ligthert said:
Hi Frank,

I misreaded your question.


Why is that objNew = New TextboxUser(kol)
I assume you want to set the databindings to an existing textbox so I would
expect something as
dim objNew as Textbox = TextboxUser(kol)

Just guessing I see to few now,

Cor

Cor,
there is a dim: dim objNew as object. But it doesn't show in this small
piece of code.
I don't think u misread the question, because your solution probably works.
But it's a lot of work for something that looks like a bug. If the dbcol is
varchar or so, then this behaviour does not occur.
I'm still researching and so far I discovered that at the end of the
validating event, the old contents are put back into the textbox.
Regards
Frank
 
Hi Frank,

Not the dim, the New is what I tried to show you.
You are setting references to an existing textbox I assume.

Cor
 
Cor Ligthert said:
Hi Frank,

Not the dim, the New is what I tried to show you.
You are setting references to an existing textbox I assume.

Cor

I don't know what u mean, everything works fine except the appearance of
deleted numbers.
Doesn't matter, I used your method. Wasn't much work because I only had to
program it in my usertextboxclass (which inherits textbox). But I still
think this is a bug.
Thanx
Frank
 
Back
Top