468,167 Members | 1,931 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,167 developers. It's quick & easy.

Can someone explain this?

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
5 1235
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
<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
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
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
<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.

Similar topics

11 posts views Thread by Maciej Nadolski | last post: by
8 posts views Thread by Peter Foti | last post: by
3 posts views Thread by MarcJessome | last post: by
5 posts views Thread by J Allen Horner | last post: by
4 posts views Thread by Richard L Rosenheim | last post: by
1 post views Thread by Tran Hong Quang | last post: by
6 posts views Thread by Dave Young | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.