By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,330 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

Controls and Database Data

P: n/a
I am wanting to get data into a common text box control without doing any
sort of "official" binding.

Here is what I have:

TextBox1.Text =
recordprocessor.nulltoalias(dsAssets.Tables("tblAs sets").Rows(rCount).Item("
SerialNo"))

------------------------------------------------------

This works pretty good, however, is there an easier way to do this?
(recordprocessor is a class I wrote that takes any value and checks for null
values).

Seems like this is a lot of trouble.

Thanks

Adam





Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Adam Clark" <ad********@lhpsoftware.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I am wanting to get data into a common text box control without doing any
sort of "official" binding.

Here is what I have:

TextBox1.Text =
recordprocessor.nulltoalias(dsAssets.Tables("tblAs sets").Rows(rCount).Item("
SerialNo"))

------------------------------------------------------

This works pretty good, however, is there an easier way to do this?
(recordprocessor is a class I wrote that takes any value and checks for null
values).

Seems like this is a lot of trouble.


Try using a strongly typed dataset.

So, the same thing that I use to do similar massaging is:

txtLastName.Text = Common.NullToNothing(dsAssets.tblAssets(rCount)("S erialNo"))

Which can be shortened if, instead of using dsAssets, use a reference to the
table directly:

Dim tbl As MyTypedDataTable = dsAssets.tblAssets

txtLastName.Text = Common.NullToNothing(tbl(rCount)("SerialNo"))
Anywho, not "TOO" much shorter, but it works :)

Mythran
Nov 20 '05 #2

P: n/a
Adam,

TextBox1.Text =
recordprocessor.nulltoalias(dsAssets.Tables("tblAs sets").Rows(rCount).Item(" SerialNo"))


depends if you are filling more textboxes when that is true than you can do
dim dt as datatable = ds(dsAssets.Tables("tblAssets"))
TextBox1.Text = recordprocessor.nulltoalias(dt.Rows(rCount)("Seria lNo"))

(It is not really a recordprocessor by the way it is an ItemProcessor, using
such a name would make in my opinion it more clear)

I hope this helps?

Cor
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.