Hello,
I am changing the property of a control:
myMenu.Item(0).Item(1).Text = "Something"
What I want is to use the path which value is in a string. Something like:
Dim path As String = ".Item(0).Item(1)."
Now I would to the following:
myMenu & path & Text = "Something"
Of course this doesn't work.
Any ideas?
Thank You,
Miguel
There is no simple solution that will enable that idea to work. Youcould get it to work using a utility method that parses the path string, and then attempts to find the various properties within that string. However, that would be a needlessly slow, complex, and error-prone way to find a control.
Whatever it is that you're trying to achieve, you should perhaps reconsider it. I'm sure you'll come up with a simpler solution.
Showing posts with label path. Show all posts
Showing posts with label path. Show all posts
Wednesday, March 28, 2012
Tuesday, March 13, 2012
stuck in a loop
Hi
I try to use this piece of code, but the page seems to get stuck in the loop. What am I doing wrong here?
Function NumberOfLinesInFile()
Dim path As String = Server.MapPath("row.txt")
Dim sr As StreamReader = New StreamReader(path)
Dim i As Integer
i = 0
Do While sr.Peek() >= 0
i = i + 1
Loop
sr.Close()
Return i
End Function
Regards
Mhello, what if sr.Peek() is always >= 0 ? check the values returned by sr !!!
The Peek function does not move to the next character, it only consumes it. Try using the sr.Read() instead.
hope this helps,
sivilian
Subscribe to:
Posts (Atom)