|
-
Oct 3rd, 2007, 03:51 AM
#1
[RESOLVED] General VB problem
This is a general VB problem. With this code from User Control:
Code:
With Extender.Parent.Controls(Extender.Name).Item(0)
.property = value
End With
... nothing happens (.property is the same as before). But this:
Code:
Extender.Parent.Controls(Extender.Name).Item(0).property = value
... works.
Am i missing something?
-
Oct 3rd, 2007, 03:55 AM
#2
Re: General VB problem
Your probably nesting With statements. Keep it at one level.
-
Oct 3rd, 2007, 04:05 AM
#3
Re: General VB problem
 Originally Posted by leinad31
Your probably nesting With statements. Keep it at one level.
No. It's the only one. There's no nesting at all.
-
Oct 3rd, 2007, 06:29 AM
#4
Re: General VB problem
I thought there has always been a problem with highly nested expressions.. as in, theres 5 dots in your statement.. I think the maximum is 3? I'm sure theres a service pack for that though.. can't remember.
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Oct 3rd, 2007, 07:00 AM
#5
Re: General VB problem
Have you try this:
Code:
(Set) Item = Extender.Parent.Controls(Extender.Name).Item(0)
With Item
.property = value
End With
Does this work?
-
Oct 3rd, 2007, 07:18 AM
#6
Re: General VB problem
some things just don't work in with blocks
take with printer for example
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 3rd, 2007, 09:16 AM
#7
Re: General VB problem
 Originally Posted by anhn
Have you try this...
How can it be an Item, when it's a property?
 Originally Posted by westconn1
some things just don't work in with blocks...
I'm not trying to get it to work, cause i'm quite satisfied with my current solution. I was just wondering, why With block causes the problem.
-
Oct 3rd, 2007, 09:29 AM
#8
PowerPoster
Re: General VB problem
try this
With Extender.Parent.Controls(Extender.Name)
Item(0).property = value
End With
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Oct 3rd, 2007, 12:41 PM
#9
Re: General VB problem
 Originally Posted by Pasvorto
try this
With Extender.Parent.Controls(Extender.Name)
Item(0).property = value
End With
OK. This works Why's so?
-
Oct 3rd, 2007, 12:48 PM
#10
PowerPoster
Re: General VB problem
I think the index is screwing it up
===================================================
If your question has been answered, mark the thread as [RESOLVED]
-
Oct 6th, 2007, 01:28 PM
#11
Re: General VB problem
Resolved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|