'AddressOf' operand must be the name of a method; no parentheses a

G

Guest

Hi All
i'm getting error with my TreeView Menu(I want to have a button with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no parentheses are needed.

I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

And called ExapndAll in page load
And on my ASP.NET page called it like this:-
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>

Can u telling me what 'm doing wrong!!
Thx
 
D

David Browne

Patrick.O.Ige said:
Hi All
i'm getting error with my TreeView Menu(I want to have a button with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no parentheses are
needed.

I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub


I have no idea, except that the VB code does not match the c# code. The VB
equivilent of that snippet is:

Public Sub ExpandAll()
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

David
 
G

Guest

Hi David,
Thx for the snippet.I tried it but still giving the error!!
The exact error is :-
AddressOf' operand must be the name of a method; no parentheses are needed.
AddHandler __ctrl.Click, AddressOf Me.ExpandAll()
Any help!



David Browne said:
Patrick.O.Ige said:
Hi All
i'm getting error with my TreeView Menu(I want to have a button with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no parentheses are
needed.

I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub


I have no idea, except that the VB code does not match the c# code. The VB
equivilent of that snippet is:

Public Sub ExpandAll()
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

David
 
G

Guest

Hi Patrcik,
Modify the line of code
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>
to
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button> and check.
You dont need to give a parenthesis here.
HTH
srini
 
G

Guest

Thx srini changed it but now i still get the error:-

Method 'Public Sub ExpandAll()' does not have the same signature as delegate
'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.

Code below:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' ExpandAll()
End Sub

Public Sub ExpandAll()
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

ASP.NET
---------
<asp:Button BorderColor=#009966 Runat=server OnClick="ExpandAll"
ID="Button1"></asp:Button>

Anu idea what i'm doing wrong!!
Patrick


srini said:
Hi Patrcik,
Modify the line of code
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>
to
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button> and check.
You dont need to give a parenthesis here.
HTH
srini

Patrick.O.Ige said:
Hi All
i'm getting error with my TreeView Menu(I want to have a button with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no parentheses are needed.

I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

And called ExapndAll in page load
And on my ASP.NET page called it like this:-
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>

Can u telling me what 'm doing wrong!!
Thx
 
G

Guest

Hi Patrick,
The ExpandAll method shoulf have the same signature as a delegate so the
ExpandAll should be like
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)
HTH
srini
Patrick.O.Ige said:
Thx srini changed it but now i still get the error:-

Method 'Public Sub ExpandAll()' does not have the same signature as delegate
'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.

Code below:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' ExpandAll()
End Sub

Public Sub ExpandAll()
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

ASP.NET
---------
<asp:Button BorderColor=#009966 Runat=server OnClick="ExpandAll"
ID="Button1"></asp:Button>

Anu idea what i'm doing wrong!!
Patrick


srini said:
Hi Patrcik,
Modify the line of code
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>
to
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button> and check.
You dont need to give a parenthesis here.
HTH
srini

Patrick.O.Ige said:
Hi All
i'm getting error with my TreeView Menu(I want to have a button with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no parentheses are needed.

I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

And called ExapndAll in page load
And on my ASP.NET page called it like this:-
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>

Can u telling me what 'm doing wrong!!
Thx
 
G

Guest

Hi Srini,
I added
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)

But in my Page_load:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll()
End Sub
The Expand() needs some argument!!(Argument not specified for parameter e)
Any ideas
VS.NET marks it as an error


srini said:
Hi Patrick,
The ExpandAll method shoulf have the same signature as a delegate so the
ExpandAll should be like
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)
HTH
srini
Patrick.O.Ige said:
Thx srini changed it but now i still get the error:-

Method 'Public Sub ExpandAll()' does not have the same signature as delegate
'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.

Code below:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' ExpandAll()
End Sub

Public Sub ExpandAll()
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

ASP.NET
---------
<asp:Button BorderColor=#009966 Runat=server OnClick="ExpandAll"
ID="Button1"></asp:Button>

Anu idea what i'm doing wrong!!
Patrick


srini said:
Hi Patrcik,
Modify the line of code
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>
to
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button> and check.
You dont need to give a parenthesis here.
HTH
srini

:

Hi All
i'm getting error with my TreeView Menu(I want to have a button with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no parentheses are needed.

I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

And called ExapndAll in page load
And on my ASP.NET page called it like this:-
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>

Can u telling me what 'm doing wrong!!
Thx
 
G

Guest

Hi Patrick,
I am not sure if this is the best way to do it but you can do it this way.
In the Page_Init method keep the following code
If Not Page.IsPostBack Then ''If you dont want to call the method during
postbacks
AddHandler Me.Load, AddressOf ExpandAll
End If
Now you dont need to call the ExpandAll on the page Load.
HTH
srini

Patrick.O.Ige said:
Hi Srini,
I added
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)

But in my Page_load:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll()
End Sub
The Expand() needs some argument!!(Argument not specified for parameter e)
Any ideas
VS.NET marks it as an error


srini said:
Hi Patrick,
The ExpandAll method shoulf have the same signature as a delegate so the
ExpandAll should be like
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)
HTH
srini
Patrick.O.Ige said:
Thx srini changed it but now i still get the error:-

Method 'Public Sub ExpandAll()' does not have the same signature as delegate
'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.

Code below:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' ExpandAll()
End Sub

Public Sub ExpandAll()
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

ASP.NET
---------
<asp:Button BorderColor=#009966 Runat=server OnClick="ExpandAll"
ID="Button1"></asp:Button>

Anu idea what i'm doing wrong!!
Patrick


:

Hi Patrcik,
Modify the line of code
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>
to
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button> and check.
You dont need to give a parenthesis here.
HTH
srini

:

Hi All
i'm getting error with my TreeView Menu(I want to have a button with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no parentheses are needed.

I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

And called ExapndAll in page load
And on my ASP.NET page called it like this:-
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>

Can u telling me what 'm doing wrong!!
Thx
 
G

Guest

Thx for the code ...But still doesn't work arg!!!!!!!!
But i forgot to tell u that i'm using the webcontrol TreeView and loading
data from XML file like this TreeNodeSrc=myxml.file".
Should that be able to work by calling ExpandALL because i don't know why it
doesn't work!



srini said:
Hi Patrick,
I am not sure if this is the best way to do it but you can do it this way.
In the Page_Init method keep the following code
If Not Page.IsPostBack Then ''If you dont want to call the method during
postbacks
AddHandler Me.Load, AddressOf ExpandAll
End If
Now you dont need to call the ExpandAll on the page Load.
HTH
srini

Patrick.O.Ige said:
Hi Srini,
I added
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)

But in my Page_load:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll()
End Sub
The Expand() needs some argument!!(Argument not specified for parameter e)
Any ideas
VS.NET marks it as an error


srini said:
Hi Patrick,
The ExpandAll method shoulf have the same signature as a delegate so the
ExpandAll should be like
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)
HTH
srini
:

Thx srini changed it but now i still get the error:-

Method 'Public Sub ExpandAll()' does not have the same signature as delegate
'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.

Code below:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' ExpandAll()
End Sub

Public Sub ExpandAll()
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

ASP.NET
---------
<asp:Button BorderColor=#009966 Runat=server OnClick="ExpandAll"
ID="Button1"></asp:Button>

Anu idea what i'm doing wrong!!
Patrick


:

Hi Patrcik,
Modify the line of code
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>
to
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button> and check.
You dont need to give a parenthesis here.
HTH
srini

:

Hi All
i'm getting error with my TreeView Menu(I want to have a button with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no parentheses are needed.

I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

And called ExapndAll in page load
And on my ASP.NET page called it like this:-
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>

Can u telling me what 'm doing wrong!!
Thx
 
G

Guest

whats the error you are getting. did you place the code in the Page_Init
method. If there is any exception you are getting please paste it.
the best
srini

Patrick.O.Ige said:
Thx for the code ...But still doesn't work arg!!!!!!!!
But i forgot to tell u that i'm using the webcontrol TreeView and loading
data from XML file like this TreeNodeSrc=myxml.file".
Should that be able to work by calling ExpandALL because i don't know why it
doesn't work!



srini said:
Hi Patrick,
I am not sure if this is the best way to do it but you can do it this way.
In the Page_Init method keep the following code
If Not Page.IsPostBack Then ''If you dont want to call the method during
postbacks
AddHandler Me.Load, AddressOf ExpandAll
End If
Now you dont need to call the ExpandAll on the page Load.
HTH
srini

Patrick.O.Ige said:
Hi Srini,
I added
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)

But in my Page_load:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll()
End Sub
The Expand() needs some argument!!(Argument not specified for parameter e)
Any ideas
VS.NET marks it as an error


:

Hi Patrick,
The ExpandAll method shoulf have the same signature as a delegate so the
ExpandAll should be like
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)
HTH
srini
:

Thx srini changed it but now i still get the error:-

Method 'Public Sub ExpandAll()' does not have the same signature as delegate
'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.

Code below:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' ExpandAll()
End Sub

Public Sub ExpandAll()
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

ASP.NET
---------
<asp:Button BorderColor=#009966 Runat=server OnClick="ExpandAll"
ID="Button1"></asp:Button>

Anu idea what i'm doing wrong!!
Patrick


:

Hi Patrcik,
Modify the line of code
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>
to
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button> and check.
You dont need to give a parenthesis here.
HTH
srini

:

Hi All
i'm getting error with my TreeView Menu(I want to have a button with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no parentheses are needed.

I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

And called ExapndAll in page load
And on my ASP.NET page called it like this:-
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>

Can u telling me what 'm doing wrong!!
Thx
 
M

Martin Dechev

Hi,

Why all this overhead - attaching to the Init event, attaching another
method to the Load event? He'd better call it directly from Page_Load:

Private Sub Page_Load(sender As Object, e As EventArgs) _
Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll(Nothing, EventArgs.Empty)
End Sub

Hope this helps
Martin Dechev
ASP.NET MVP
srini said:
Hi Patrick,
I am not sure if this is the best way to do it but you can do it this way.
In the Page_Init method keep the following code
If Not Page.IsPostBack Then ''If you dont want to call the method during
postbacks
AddHandler Me.Load, AddressOf ExpandAll
End If
Now you dont need to call the ExpandAll on the page Load.
HTH
srini

Patrick.O.Ige said:
Hi Srini,
I added
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)

But in my Page_load:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll()
End Sub
The Expand() needs some argument!!(Argument not specified for parameter e)
Any ideas
VS.NET marks it as an error


srini said:
Hi Patrick,
The ExpandAll method shoulf have the same signature as a delegate so the
ExpandAll should be like
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)
HTH
srini
:

Thx srini changed it but now i still get the error:-

Method 'Public Sub ExpandAll()' does not have the same signature as delegate
'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.

Code below:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' ExpandAll()
End Sub

Public Sub ExpandAll()
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

ASP.NET
---------
<asp:Button BorderColor=#009966 Runat=server OnClick="ExpandAll"
ID="Button1"></asp:Button>

Anu idea what i'm doing wrong!!
Patrick


:

Hi Patrcik,
Modify the line of code
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>
to
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button> and check.
You dont need to give a parenthesis here.
HTH
srini

:

Hi All
i'm getting error with my TreeView Menu(I want to have a button with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no parentheses are needed.

I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

And called ExapndAll in page load
And on my ASP.NET page called it like this:-
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>

Can u telling me what 'm doing wrong!!
Thx
 
G

Guest

Hi Martin,
Thanks for the inputs.
If you see the last line of my message i asked not to call the ExpandAll in
the page load again. But its a really valid point. We can call
ExpandAll(nothing, eventargs.empty).
Thanks again
srini

Martin Dechev said:
Hi,

Why all this overhead - attaching to the Init event, attaching another
method to the Load event? He'd better call it directly from Page_Load:

Private Sub Page_Load(sender As Object, e As EventArgs) _
Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll(Nothing, EventArgs.Empty)
End Sub

Hope this helps
Martin Dechev
ASP.NET MVP
srini said:
Hi Patrick,
I am not sure if this is the best way to do it but you can do it this way.
In the Page_Init method keep the following code
If Not Page.IsPostBack Then ''If you dont want to call the method during
postbacks
AddHandler Me.Load, AddressOf ExpandAll
End If
Now you dont need to call the ExpandAll on the page Load.
HTH
srini

Patrick.O.Ige said:
Hi Srini,
I added
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)

But in my Page_load:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll()
End Sub
The Expand() needs some argument!!(Argument not specified for parameter e)
Any ideas
VS.NET marks it as an error


:

Hi Patrick,
The ExpandAll method shoulf have the same signature as a delegate so the
ExpandAll should be like
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)
HTH
srini
:

Thx srini changed it but now i still get the error:-

Method 'Public Sub ExpandAll()' does not have the same signature as delegate
'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.

Code below:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' ExpandAll()
End Sub

Public Sub ExpandAll()
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

ASP.NET
---------
<asp:Button BorderColor=#009966 Runat=server OnClick="ExpandAll"
ID="Button1"></asp:Button>

Anu idea what i'm doing wrong!!
Patrick


:

Hi Patrcik,
Modify the line of code
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>
to
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button> and check.
You dont need to give a parenthesis here.
HTH
srini

:

Hi All
i'm getting error with my TreeView Menu(I want to have a button with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no parentheses are needed.

I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

And called ExapndAll in page load
And on my ASP.NET page called it like this:-
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>

Can u telling me what 'm doing wrong!!
Thx

 
P

Patrick.O.Ige

Hi Martin,
Thx for the code!
I'll try that tommorow and let u know!
cheers!


Martin Dechev said:
Hi,

Why all this overhead - attaching to the Init event, attaching another
method to the Load event? He'd better call it directly from Page_Load:

Private Sub Page_Load(sender As Object, e As EventArgs) _
Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll(Nothing, EventArgs.Empty)
End Sub

Hope this helps
Martin Dechev
ASP.NET MVP
srini said:
Hi Patrick,
I am not sure if this is the best way to do it but you can do it this way.
In the Page_Init method keep the following code
If Not Page.IsPostBack Then ''If you dont want to call the method during
postbacks
AddHandler Me.Load, AddressOf ExpandAll
End If
Now you dont need to call the ExpandAll on the page Load.
HTH
srini
parameter
as
button
parentheses
are needed.
I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

And called ExapndAll in page load
And on my ASP.NET page called it like this:-
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>

Can u telling me what 'm doing wrong!!
Thx

 
P

Patrick.O.Ige

Thx srini,
I'll try Martins idea and let u guys know!
Cheers



srini said:
Hi Martin,
Thanks for the inputs.
If you see the last line of my message i asked not to call the ExpandAll in
the page load again. But its a really valid point. We can call
ExpandAll(nothing, eventargs.empty).
Thanks again
srini

Martin Dechev said:
Hi,

Why all this overhead - attaching to the Init event, attaching another
method to the Load event? He'd better call it directly from Page_Load:

Private Sub Page_Load(sender As Object, e As EventArgs) _
Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll(Nothing, EventArgs.Empty)
End Sub

Hope this helps
Martin Dechev
ASP.NET MVP
srini said:
Hi Patrick,
I am not sure if this is the best way to do it but you can do it this way.
In the Page_Init method keep the following code
If Not Page.IsPostBack Then ''If you dont want to call the method during
postbacks
AddHandler Me.Load, AddressOf ExpandAll
End If
Now you dont need to call the ExpandAll on the page Load.
HTH
srini

:

Hi Srini,
I added
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)

But in my Page_load:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll()
End Sub
The Expand() needs some argument!!(Argument not specified for
parameter
e)
Any ideas
VS.NET marks it as an error


:

Hi Patrick,
The ExpandAll method shoulf have the same signature as a delegate
so
the
ExpandAll should be like
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)
HTH
srini
:

Thx srini changed it but now i still get the error:-

Method 'Public Sub ExpandAll()' does not have the same signature
as
delegate
'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.

Code below:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' ExpandAll()
End Sub

Public Sub ExpandAll()
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

ASP.NET
---------
<asp:Button BorderColor=#009966 Runat=server OnClick="ExpandAll"
ID="Button1"></asp:Button>

Anu idea what i'm doing wrong!!
Patrick


:

Hi Patrcik,
Modify the line of code
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>
to
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button> and check.
You dont need to give a parenthesis here.
HTH
srini

:

Hi All
i'm getting error with my TreeView Menu(I want to have a
button
with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no
parentheses
are needed.
I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

And called ExapndAll in page load
And on my ASP.NET page called it like this:-
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>

Can u telling me what 'm doing wrong!!
Thx

 
G

Guest

Hi Martin,
After doing ExpandAll(Nothing, EventArgs.Empty)
No error but it doesn't work i mean the event doesn't fire arggg!!!
I have done everything i have included all the code to scan trough below!
Thx

My code below:-
Public Sub ExpandAll(ByVal sender As Object, ByVal e As System.EventArgs)
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll(Nothing, EventArgs.Empty)
End Sub


In ASp.NET
-------------
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button>

My TreeView:-
-----------------
<IE:TREEVIEW id="tvFamilyTree" runat="server"
SystemImagesPath="/webctrl_client/1_0/images/"
SHOWLINES="true" SHOWTOOLTIP="true"
DefaultStyle="font-family:arial;font-size:11px;color:#004080;border: solid
0px #004080; margin: 0px; background: #ffffff; white-space:
nowrap;cursor:default;"
HoverStyle="font-family:arial;font-weight:bold;font-size:11px;color:red;text-decoration:underline
red; margin: 0px; background:#ffffff; white-space: nowrap;
cursor:pointer;cursor:hand;"
BorderStyle="0" Showplus="true" Indent="5" ExpandedImageUrl="smallest.gif"
SelectExpands="true">

<ie:TreeNode TreeNodeSrc="MyXmlfile.xml" Text="<font size='4'>Call
Center</font>" Expanded="True" ID="Treenode1"
NavigateUrl="default.aspx"></ie:TreeNode>

</IE:TREEVIEW>




Martin Dechev said:
Hi,

Why all this overhead - attaching to the Init event, attaching another
method to the Load event? He'd better call it directly from Page_Load:

Private Sub Page_Load(sender As Object, e As EventArgs) _
Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll(Nothing, EventArgs.Empty)
End Sub

Hope this helps
Martin Dechev
ASP.NET MVP
srini said:
Hi Patrick,
I am not sure if this is the best way to do it but you can do it this way.
In the Page_Init method keep the following code
If Not Page.IsPostBack Then ''If you dont want to call the method during
postbacks
AddHandler Me.Load, AddressOf ExpandAll
End If
Now you dont need to call the ExpandAll on the page Load.
HTH
srini

Patrick.O.Ige said:
Hi Srini,
I added
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)

But in my Page_load:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll()
End Sub
The Expand() needs some argument!!(Argument not specified for parameter e)
Any ideas
VS.NET marks it as an error


:

Hi Patrick,
The ExpandAll method shoulf have the same signature as a delegate so the
ExpandAll should be like
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)
HTH
srini
:

Thx srini changed it but now i still get the error:-

Method 'Public Sub ExpandAll()' does not have the same signature as delegate
'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.

Code below:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' ExpandAll()
End Sub

Public Sub ExpandAll()
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

ASP.NET
---------
<asp:Button BorderColor=#009966 Runat=server OnClick="ExpandAll"
ID="Button1"></asp:Button>

Anu idea what i'm doing wrong!!
Patrick


:

Hi Patrcik,
Modify the line of code
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>
to
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button> and check.
You dont need to give a parenthesis here.
HTH
srini

:

Hi All
i'm getting error with my TreeView Menu(I want to have a button with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no parentheses are needed.

I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

And called ExapndAll in page load
And on my ASP.NET page called it like this:-
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>

Can u telling me what 'm doing wrong!!
Thx

 
G

Guest

Hi srini,
After doing ExpandAll(Nothing, EventArgs.Empty)
No error but it doesn't work i mean the event doesn't fire arggg!!!
I have done everything i have included all the code to scan trough below!
Thx

My code below:-
Public Sub ExpandAll(ByVal sender As Object, ByVal e As System.EventArgs)
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll(Nothing, EventArgs.Empty)
End Sub


In ASp.NET
-------------
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button>

My TreeView:-
-----------------
<IE:TREEVIEW id="tvFamilyTree" runat="server"
SystemImagesPath="/webctrl_client/1_0/images/"
SHOWLINES="true" SHOWTOOLTIP="true"
DefaultStyle="font-family:arial;font-size:11px;color:#004080;border: solid
0px #004080; margin: 0px; background: #ffffff; white-space:
nowrap;cursor:default;"
HoverStyle="font-family:arial;font-weight:bold;font-size:11px;color:red;text-decoration:underline
red; margin: 0px; background:#ffffff; white-space: nowrap;
cursor:pointer;cursor:hand;"
BorderStyle="0" Showplus="true" Indent="5" ExpandedImageUrl="smallest.gif"
SelectExpands="true">

<ie:TreeNode TreeNodeSrc="MyXmlfile.xml" Text="<font size='4'>Call
Center</font>" Expanded="True" ID="Treenode1"
NavigateUrl="default.aspx"></ie:TreeNode>

</IE:TREEVIEW>


srini said:
Hi Martin,
Thanks for the inputs.
If you see the last line of my message i asked not to call the ExpandAll in
the page load again. But its a really valid point. We can call
ExpandAll(nothing, eventargs.empty).
Thanks again
srini

Martin Dechev said:
Hi,

Why all this overhead - attaching to the Init event, attaching another
method to the Load event? He'd better call it directly from Page_Load:

Private Sub Page_Load(sender As Object, e As EventArgs) _
Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll(Nothing, EventArgs.Empty)
End Sub

Hope this helps
Martin Dechev
ASP.NET MVP
srini said:
Hi Patrick,
I am not sure if this is the best way to do it but you can do it this way.
In the Page_Init method keep the following code
If Not Page.IsPostBack Then ''If you dont want to call the method during
postbacks
AddHandler Me.Load, AddressOf ExpandAll
End If
Now you dont need to call the ExpandAll on the page Load.
HTH
srini

:

Hi Srini,
I added
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)

But in my Page_load:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ExpandAll()
End Sub
The Expand() needs some argument!!(Argument not specified for parameter e)
Any ideas
VS.NET marks it as an error


:

Hi Patrick,
The ExpandAll method shoulf have the same signature as a delegate so the
ExpandAll should be like
Public Sub ExpandAll(Byval sender As Object, Byval e As System.EventArgs)
HTH
srini
:

Thx srini changed it but now i still get the error:-

Method 'Public Sub ExpandAll()' does not have the same signature as delegate
'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.

Code below:-
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
' ExpandAll()
End Sub

Public Sub ExpandAll()
For i As Integer = 0 To tvFamilyTree.Nodes.Count - 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

ASP.NET
---------
<asp:Button BorderColor=#009966 Runat=server OnClick="ExpandAll"
ID="Button1"></asp:Button>

Anu idea what i'm doing wrong!!
Patrick


:

Hi Patrcik,
Modify the line of code
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>
to
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll"></asp:Button> and check.
You dont need to give a parenthesis here.
HTH
srini

:

Hi All
i'm getting error with my TreeView Menu(I want to have a button with
ExpandALL and CollapseALL):-
Error:-
'AddressOf' operand must be the name of a method; no parentheses are needed.

I use VB.Net and i changed the C# code from:-
private void ExpandAll()
{
for(int i=0; i < yourTree.Nodes.Count; i++)
{
yourTree.Nodes.Expanded = true;
}
}
TO

Public Sub ExpandAll()
Dim i As Integer
For i = 0 To tvFamilyTree.Nodes.Count - 1 Step i + 1
tvFamilyTree.Nodes(i).Expanded = True
Next
End Sub

And called ExapndAll in page load
And on my ASP.NET page called it like this:-
<asp:Button BorderColor=#009966 Runat=server
OnClick="ExpandAll()"></asp:Button>

Can u telling me what 'm doing wrong!!
Thx

 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top