473,326 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

How to visible in panels

I have 8 panels control on right side uing treeview control. this will
work in vb6 but can't figuring in vb.net. and i got error

Sub PanelVisible(ByVal szPanel As String)
Dim i As Integer, VisiblePanel As New Panel
For i = 0 To 7
If TypeOf VisiblePanel.Controls(i) Is Panel Then
===> Additional information: Specified argument was out of the range of
valid values.
If VisiblePanel.Controls(i).Name = szPanel Then
VisiblePanel.Controls(i).Visible = True

VisiblePanel.Controls(i).Location = New
Point(160, 8)
VisiblePanel.Controls(i).Size = New Size(304, 256)
Else
VisiblePanel.Controls(i).Visible = False
End If
End If
Next
End Sub

Private Sub trvPreference_AfterSelect(ByVal sender As System.Object,
ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles
trvPreference.AfterSelect
Dim i As String
i = e.Node.Text
Select Case i
Case "Connect"
Dim cConnect As String
cConnect = "Connect" 'Panel1.Name
PanelVisible(cConnect)

Case "User Info"
Dim cUser As String
cUser = "User Info" 'Panel2.Name
PanelVisible(cUser)

Case "Identd"
Dim cIdent As String
cIdent = "Ident" 'Panel3.Name
PanelVisible(cIdent)

Case "Firewall"
Dim cFireWall As String
cFireWall = "Firewalls" 'Panel4.Name
PanelVisible(cFireWall)

Case "DCC"
Dim cDCC As String
cDCC = "DCC" 'Panel5.Name
PanelVisible(cDCC)

Case "DNS"
Dim cDNS As String
cDNS = "DNS" 'Panel6.Name
PanelVisible(cDNS)

Case "Misc"
Dim cMisc As String
cMisc = Misc" 'Panel7.Name
PanelVisible(cMisc)

Case "Colours"
' Panel1.Visible = False
' Panel2.Visible = False
' Panel3.Visible = False
' Panel4.Visible = False
' Panel5.Visible = False
' Panel6.Visible = False
' Panel7.Visible = False
'With Panel8
' .Visible = True
'.Location = New Point(160, 8)
'.Size = New Size(304, 268)
'End With

Dim c As String
c = "Colours" 'Panel8.Name
PanelVisible(c)

End Select
End Sub

ne ideas u can help me?
regards

Jul 21 '05 #1
6 2921
> Dim VisiblePanel As New Panel
How many panels did you declare here? Looks like 1 to me.
For i = 0 To 7
If TypeOf VisiblePanel.Controls(i) Is Panel Then

There's only one VisiblePanel Object so you will get an out of range error.
I think you meant to enumerate the Panels on the form.

\\\
Sub PanelVisible(ByVal PanelObj As Panel)
For Each obj As Control In Me.Controls
If TypeOf obj Is Panel Then
If obj Is PanelObj Then
obj.Visible = True
obj.Location = New Point(160,8)
obj.Size = New Size(304,256)
Else
obj.Visible = False
End If
End If
Next
End Sub
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
Jul 21 '05 #2
how do u call PanelVisible in Private Sub treeview_AfterSelect?

Mick Doherty wrote:
Dim VisiblePanel As New Panel

How many panels did you declare here? Looks like 1 to me.
For i = 0 To 7
If TypeOf VisiblePanel.Controls(i) Is Panel Then

There's only one VisiblePanel Object so you will get an out of range
error.

I think you meant to enumerate the Panels on the form.

\\\
Sub PanelVisible(ByVal PanelObj As Panel)
For Each obj As Control In Me.Controls
If TypeOf obj Is Panel Then
If obj Is PanelObj Then
obj.Visible = True
obj.Location = New Point(160,8)
obj.Size = New Size(304,256)
Else
obj.Visible = False
End If
End If
Next
End Sub
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004

Jul 21 '05 #3
hi mike,
what i'm attempting to do is when user click
treeview_afterselect.........for example clicking "Connect" will turn
this panel visible to true and rest of panels will be invisible to
false and if user click "Identd" will turn this panel visible to true
and rest of panels will be invisible to false and so forth...

ne ideas u can help me.
regards

Supra wrote:
how do u call PanelVisible in Private Sub treeview_AfterSelect?

Mick Doherty wrote:
> Dim VisiblePanel As New Panel

How many panels did you declare here? Looks like 1 to me.
> For i = 0 To 7
> If TypeOf VisiblePanel.Controls(i) Is Panel Then

There's only one VisiblePanel Object so you will get an out of range
error.

I think you meant to enumerate the Panels on the form.

\\\
Sub PanelVisible(ByVal PanelObj As Panel)
For Each obj As Control In Me.Controls
If TypeOf obj Is Panel Then
If obj Is PanelObj Then
obj.Visible = True
obj.Location = New Point(160,8)
obj.Size = New Size(304,256)
Else
obj.Visible = False
End If
End If
Next
End Sub
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004


Jul 21 '05 #4
Supra,

Typed in this message not tested so watch typos and other errors.
\\\
Dim myPanel As Panel() = New Panel() {Panel1, Panel2, etc right panel names}
For i as integer = 0 to 7
if i = selectedindex then
myPanel(i).visible = true
else
myPanel(i).visible = false
end if
Next
///

I am curious is there a reason why you ask this question in this newsgroup
instead of the newsgroup
microsoft.public.dotnet.languages.vb ?

I hope that the solution above helps?

Cor
Jul 21 '05 #5

hi mike,
how do u call procedure events?

Supra wrote:
hi mike,
what i'm attempting to do is when user click
treeview_afterselect.........for example clicking "Connect" will
turn this panel visible to true and rest of panels will be invisible
to false and if user click "Identd" will turn this panel visible to
true and rest of panels will be invisible to false and so forth...

ne ideas u can help me.
regards

Supra wrote:
how do u call PanelVisible in Private Sub treeview_AfterSelect?

Mick Doherty wrote:
> Dim VisiblePanel As New Panel
How many panels did you declare here? Looks like 1 to me.

> For i = 0 To 7
> If TypeOf VisiblePanel.Controls(i) Is Panel Then
There's only one VisiblePanel Object so you will get an out of range
error.

I think you meant to enumerate the Panels on the form.

\\\
Sub PanelVisible(ByVal PanelObj As Panel)
For Each obj As Control In Me.Controls
If TypeOf obj Is Panel Then
If obj Is PanelObj Then
obj.Visible = True
obj.Location = New Point(160,8)
obj.Size = New Size(304,256)
Else
obj.Visible = False
End If
End If
Next
End Sub
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004


Jul 21 '05 #6
thank mike

i got it working
i can called like this:
PanelsVisible(Panel8)
WOOOOOOOOOOOOOOOOOOOOWwwwwwwwwwwwwww!
regards,

Supra wrote:

hi mike,
how do u call procedure events?

Supra wrote:
hi mike,
what i'm attempting to do is when user click
treeview_afterselect.........for example clicking "Connect" will
turn this panel visible to true and rest of panels will be invisible
to false and if user click "Identd" will turn this panel visible to
true and rest of panels will be invisible to false and so forth...

ne ideas u can help me.
regards

Supra wrote:
how do u call PanelVisible in Private Sub treeview_AfterSelect?

Mick Doherty wrote:

> Dim VisiblePanel As New Panel
How many panels did you declare here? Looks like 1 to me.

> For i = 0 To 7
> If TypeOf VisiblePanel.Controls(i) Is Panel Then
There's only one VisiblePanel Object so you will get an out of
range error.

I think you meant to enumerate the Panels on the form.

\\\
Sub PanelVisible(ByVal PanelObj As Panel)
For Each obj As Control In Me.Controls
If TypeOf obj Is Panel Then
If obj Is PanelObj Then
obj.Visible = True
obj.Location = New Point(160,8)
obj.Size = New Size(304,256)
Else
obj.Visible = False
End If
End If
Next
End Sub
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004


Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: PZ | last post by:
OSS 2005 The First International Conference on Open Source Systems Genova, July 11 - 15, 2005 CALL FOR PANELS http://oss2005.case.unibz.it Submissions of panels are solicited for the "First...
0
by: PZ | last post by:
OSS 2005 The First International Conference on Open Source Systems Genova, July 11 - 15, 2005 CALL FOR PANELS http://oss2005.case.unibz.it Submissions of panels are solicited for the "First...
4
by: Miguel Dias Moura | last post by:
Hello, i have 5 panels in an ASP.net / VB page. The panel 1 is visible the other 4 are NOT visible. I also have 5 images: image 1, image 2, ..., image5. When i click one of the images,...
6
by: Selden McCabe | last post by:
I have a form with a bunch of image buttons. When the user moves the mouse over a button, I want to do two things: 1. change the Imagebutton's picture, and 2. make another control visible. I'm...
6
by: Supra | last post by:
I have 8 panels control on right side uing treeview control. this will work in vb6 but can't figuring in vb.net. and i got error Sub PanelVisible(ByVal szPanel As String) Dim i As Integer,...
2
by: Kristof Taveirne | last post by:
Hi, I'm developing an application on PDA using WindowsCE. In my application I have several tabs at the bottom of my screen. However, in one of the tabs I've placed 2 radiobutton, used to switch...
0
by: aarepasky | last post by:
I am using ASP.NET 2.0 and C#. I am creating a page with multiple panels on it. In the panels are user controls that have the screen layout to input data. I only show one panel at a time by...
1
by: Ben | last post by:
Hi We have a number of Panels on our windows form, we have controls inside and outside of the panels. I am having problems tabbing between controls, it appers to be when the controls are...
3
by: =?Utf-8?B?RnJlZHJpaw==?= | last post by:
Hi I have a problem in one of my user controls that I cannot find any solution for. I'am running C# for Visual studio 2003 and developing a windows application. The problem is the following: I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.