Showing posts with label adding. Show all posts
Showing posts with label adding. Show all posts

Saturday, March 31, 2012

Text Box cocatenating instead of adding

When I run this line of code, I'm getting 444 instead of 12:
lblWkTotal1.text = lblSatTotal.text + lblSunTotal.text + lblMonTotal.text + lblTueTotal.text + lblWedTotal.text + lblThuTotal.text + lblFriTotal.text
If I run this line of code, I'm getting this error message: Cast from string "" to type 'Decimal' is not valid.
lblWkTotal1.text = CDec(lblSatTotal.text) + CDec(lblSunTotal.text) + CDec(lblMonTotal.text) + CDec(lblTueTotal.text) + CDec(lblWedTotal.text) + CDec(lblThuTotal.text) + CDec(lblFriTotal.text)
Any ideas how to correct the problem.
Thanks

Try changing from cDec to cDbl


Hi

Try usingCInt(TxtboxName.text).


Thanks David
When I change it to CDbl the followuing messages are generated:
[FormatException: Input string was not in a correct format.]
[InvalidCastException: Cast from string "" to type 'Double' is not valid.]
Any ideas where to go from here?
Franco

David
Changing to CDbl works OK if I first set the default text to 0.
Thanks for the suggestion.
Franco

Try forcing the result to a string
textBox.Text = CStr(Cint(blah) + CInt(Blah))
or
Dim i as Int32
i = CInt(Blah) + ...
textBox.Text = i.ToString()

Saturday, March 24, 2012

Text Search component

Can anyone recommend a good component For adding a search feature to a
website that will search the text in a database

Thanks in advance

JohnWhy can't you build it yourself?
It's very easy - but there are multiple considerations that a single
component could never narrow down...
First, you need to decide which field(s) you are searching. You can use a
DropDownList or TextBox

Then, you need to decide how you want to display the results. You could use
a Grid, or a customized way of displaying, say, like a DataList - -

The rest is just connecting to the dabase, querying the database and
retrieving the results, basically.

Is there something you're looking for that's different than what I've
described here?

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
"John Haycock" <jhayc@.blueyonder.co.ukwrote in message
news:7rSRg.17359$aP3.3774@.fe3.news.blueyonder.co.u k...

Quote:

Originally Posted by

Can anyone recommend a good component For adding a search feature to a
website that will search the text in a database
>
Thanks in advance
>
John
>
>
>


"David Wier" <david_wier@.noSpamhotmail.comwrote in message
news:%23qPHQtM4GHA.1268@.TK2MSFTNGP02.phx.gbl...

Quote:

Originally Posted by

Why can't you build it yourself?
It's very easy - but there are multiple considerations that a single
component could never narrow down...
First, you need to decide which field(s) you are searching. You can use a
DropDownList or TextBox
>
Then, you need to decide how you want to display the results. You could
use
a Grid, or a customized way of displaying, say, like a DataList - -
>
The rest is just connecting to the dabase, querying the database and
retrieving the results, basically.
>
Is there something you're looking for that's different than what I've
described here?
>
--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
>


Hi David
Thanks for the help
I would want to be able to search the database for specific strings like you
do in a standard search engine so the user could search for exact string
matches or keywords.

I could set up most of what you have talked about but I imagine you would
need to use some advanced regular expressions and I wouldn't know where to
begin

John

Text Search component

Can anyone recommend a good component For adding a search feature to a
website that will search the text in a database
Thanks in advance
JohnWhy can't you build it yourself?
It's very easy - but there are multiple considerations that a single
component could never narrow down...
First, you need to decide which field(s) you are searching. You can use a
DropDownList or TextBox
Then, you need to decide how you want to display the results. You could use
a Grid, or a customized way of displaying, say, like a DataList - -
The rest is just connecting to the dabase, querying the database and
retrieving the results, basically.
Is there something you're looking for that's different than what I've
described here?
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
"John Haycock" <jhayc@.blueyonder.co.uk> wrote in message
news:7rSRg.17359$aP3.3774@.fe3.news.blueyonder.co.uk...
> Can anyone recommend a good component For adding a search feature to a
> website that will search the text in a database
> Thanks in advance
> John
>
>
"David Wier" <david_wier@.noSpamhotmail.com> wrote in message
news:%23qPHQtM4GHA.1268@.TK2MSFTNGP02.phx.gbl...
> Why can't you build it yourself?
> It's very easy - but there are multiple considerations that a single
> component could never narrow down...
> First, you need to decide which field(s) you are searching. You can use a
> DropDownList or TextBox
> Then, you need to decide how you want to display the results. You could
> use
> a Grid, or a customized way of displaying, say, like a DataList - -
> The rest is just connecting to the dabase, querying the database and
> retrieving the results, basically.
> Is there something you're looking for that's different than what I've
> described here?
> --
> David Wier
> MVP/ASPInsider
> http://aspnet101.com
> http://aspexpress.com
>
Hi David
Thanks for the help
I would want to be able to search the database for specific strings like you
do in a standard search engine so the user could search for exact string
matches or keywords.
I could set up most of what you have talked about but I imagine you would
need to use some advanced regular expressions and I wouldn't know where to
begin
John