473,394 Members | 1,875 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,394 software developers and data experts.

What's wrong with this

82
Expand|Select|Wrap|Line Numbers
  1. Private Sub NextButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NextButton.Click
  2.  
  3.         Dim PageSelected As String = "Page"
  4.         Page = Page + 1
  5.  
  6.         Select Case PageSelected
  7.             Case 1
  8.                 AllHide()  'subroutine that hides all things on the page
  9.                 VisibleOnPage01()  'subroutine that shows things applicable to Page01
  10.             Case 2
  11.                 AllHide()
  12.                 VisibleOnPage02()
  13.             Case 3
  14.                 AllHide()
  15.                 VisibleOnPage03()
  16.             Case 4
  17.                 AllHide()
  18.                 VisibleOnPage04()
  19.             Case Else
  20.                 MsgBox("error")
  21.  End Select
  22.     End Sub
  23.  
Each time the button is pressed it should increment the variable page the run through the case statement untill the page is found then show the items on the page, but all that happens is a msgbox appears and says error. I don't know why.
Nov 30 '08 #1
5 1251
Dököll
2,364 Expert 2GB
@mrcw
Perhaps in 'Dim PageSelected As String = "Page"
' "Page" is not needed. Looks like you defining page twice, at quick glance...
Dec 1 '08 #2
@mrcw

Hi there.

There some mistakes in your code.

You declare PageSelected as string and give then "Page". OK
After you Add 1 to the variable Page. I suppose this variable was declare elsewhere if not you need to declare and initialize this variable Page.

In the Select Case you use PageSelected. This variable never will have the value 1. Remember its string and has "Page" as contents.

I hope this help you

Rpicilli
Dec 1 '08 #3
mrcw
82
Thanks for the reply, but I'm afraid it's still as clear as mud! Could you rearrange my code to give me a case statement that works please. I learn better by building on a somple example.
Thanx
mrcw
Dec 1 '08 #4
@mrcw
You know, I can do that but you will learn nothing. The better way to learn is reading books or help files and try a lot. Excuse me by this kind of comments but that is the true.

Expand|Select|Wrap|Line Numbers
  1. 'The line below must be off of your buttom click event or allways the Page 'will 'be 0 and you'll be able to select only the first page.
  2. Dim iPage as integer = 0
  3.  
  4. Dim PageSelected As String = "Page" 
  5.  
  6.         iPage = iPage + 1 
  7.  
  8.         Select Case iPage 
  9.             Case 1 
  10.                 AllHide()  'subroutine that hides all things on the page 
  11.                 VisibleOnPage01()  'subroutine that shows things applicable to Page01 
  12.             Case 2 
  13.                 AllHide() 
  14.                 VisibleOnPage02() 
  15.             Case 3 
  16.                 AllHide() 
  17.                 VisibleOnPage03() 
  18.             Case 4 
  19.                 AllHide() 
  20.                 VisibleOnPage04() 
  21.             Case Else 
  22.                 MsgBox("error") 
  23.  End Select 
  24.  
  25.  
  26.  

That change in the code will make your select works, just the Select not the other Functions that you've created.
Dec 2 '08 #5
mrcw
82
Thanks ripicili but I had allready worked it out - my code was similar but not exactly to yours
mrcw
Dec 2 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mike Henley | last post by:
I first came across rebol a while ago; it seemed interesting but then i was put off by its proprietary nature, although the core of the language is a free download. Recently however, i can't...
72
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for...
121
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode...
28
by: Madhur | last post by:
Hello what about this nice way to open a file in single line rather than using if and else. #include<stdio.h> void main() { FILE *nd; clrscr();...
9
by: Pyenos | last post by:
import cPickle, shelve could someone tell me what things are wrong with my code? class progress: PROGRESS_TABLE_ACTIONS= DEFAULT_PROGRESS_DATA_FILE="progress_data" PROGRESS_OUTCOMES=
3
by: Siong.Ong | last post by:
Dear all, my PHP aims to update a MySQL database by selecting record one by one and modify then save. Here are my PHP, but I found that it doesnt work as it supposed to be, for example, when...
89
by: Tubular Technician | last post by:
Hello, World! Reading this group for some time I came to the conclusion that people here are split into several fractions regarding size_t, including, but not limited to, * size_t is the...
20
by: Daniel.C | last post by:
Hello. I just copied this code from my book with no modification : #include <stdio.h> /* count characters in input; 1st version */ main() { long nc; nc = 0;
24
by: MU | last post by:
Hello I have some code that sets a dropdownlist control with a parameter from the querystring. However, when the querystring is empty, I get an error. Here is my code: Protected Sub...
2
by: mingke | last post by:
Hi... So I have problem with my if condition..I don't know what's wrong but it keeps resulting the wrong answer.... So here's the part of my code I have problem with: for (i=0; i<size2;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.