simple problem - need something like IsNull

G

Guest

Hi,

I am passing some paramaters to a function is asp.net (vb.net). The values
come from a textbox, how can I pass in a zero by default if the user tries to
enter a blank space?

I have..

BLL.Forecast.SaveChanges_DaysForecast(dgItem.Cells(21).Text)

I want something like
BLL.Forecast.SaveChanges_DaysForecast(IsSpace(dgItem.Cells(21).Text,0))

Any ideas?
 
S

S. Justin Gengo

Public Function IsSpace(ByVal textEntered As String) As String
'---Replace spaces in check with nothing (in case user has entered more
than one space)
If textEntered.Replace(" ", "").Length = 0 Then
Return "0"
Else
Return textEntered
End If
End Sub

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
G

Guest

Thanks, that will work. I thought maybe there was an inbuilt function I didnt
know about it.
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top