null in textbox

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
 
P

::P:e:s:c:e:::M:a:r:c:o::

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
 
C

Cor Ligthert

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
 
F

Frank

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
 
C

Cor Ligthert

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
 
F

Frank

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top