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

Can someone explain this?

P: n/a
Let's say you set

txtlastname1.visible = true

Then

DirectCast(Page.FindControl("txtLastName1"), TextBox).Visible = False
Why when you check txtlastname1.visible it is equal to True?
Can someone please explain? Thanks

Nov 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Watcha-talkin-about-foo?

txtLastName1.Visible = True
DirectCast(Page.FindControl("txtLastName1"), TextBox).Visible = False
Response.Write(txtLastName1.Visible)

Shows up false to me.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
<kl******@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Let's say you set

txtlastname1.visible = true

Then

DirectCast(Page.FindControl("txtLastName1"), TextBox).Visible = False
Why when you check txtlastname1.visible it is equal to True?
Can someone please explain? Thanks

Nov 19 '05 #2

P: n/a
<kl******@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Let's say you set

txtlastname1.visible = true

Then

DirectCast(Page.FindControl("txtLastName1"), TextBox).Visible = False
Why when you check txtlastname1.visible it is equal to True?
Can someone please explain? Thanks


I bet you have a typo somewhere. Try this:

Response.Write(txtlastname1.Equal(Page.FindControl ("txtLastName1")))

John Saunders
Nov 19 '05 #3

P: n/a
Here is what I'm doing
blnShow = true
Sub Show (ByVal blnShow As Boolean)

txtlastname1.visible = blnShow

if txtlastname1.visible = true then
response.write("1")
else
response.write("2")
end if

2 comes up. Why?

Nov 19 '05 #4

P: n/a
The problem is with your code...it should be showing 1 (and it is on my
computer)...What value is being passed into the Show() call? What is
blnShow = true? a field declaration? are you just telling us that you are
sure it's true?
Show(false) ' displays 2
Show(true) ' displays 1

if you are doing Show(false) but have a field named blnShow that you are
setting to true, such as :

private blnShow as boolean = true
public sub Page_Load()
Show(false)
end sub

Sub Show(Byval blnShow as boolean)
...
end sub

the local blnShow variable you are declaring in the Show function overrides
the more global blnShow field declared at the top. In other words, you
might be getting confused because you have two variables named the same
thing (bad) at different scopes and it isn't the one you are expecting.

karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
<kl******@hotmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Here is what I'm doing
blnShow = true
Sub Show (ByVal blnShow As Boolean)

txtlastname1.visible = blnShow

if txtlastname1.visible = true then
response.write("1")
else
response.write("2")
end if

2 comes up. Why?

Nov 19 '05 #5

P: n/a
<kl******@hotmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Here is what I'm doing
blnShow = true
Sub Show (ByVal blnShow As Boolean)

txtlastname1.visible = blnShow

if txtlastname1.visible = true then
response.write("1")
else
response.write("2")
end if

2 comes up. Why?

Hey, just for fun, could you send us some context? Like:

Sub Page_Load(sender as Object, EventArgs as e)
Dim blnShow as Boolean = True
Show(blnShow)
End Sub

Sub Show (ByVal blnShow As Boolean)

txtlastname1.visible = blnShow

if txtlastname1.visible = true then
response.write("1")
else
response.write("2")
end if
End Sub
What you actually sent us so far looks like it could be VBScript.

John Saunders
Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.