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

Entry Level classes: Cases





Visual Studio.Net
Windows 2000 Server
also on Windows XP Professional

I am a new user. I am not a programmer. Trying to learn. This actually is a question on a quiz. I created something in VS.NET but had no luck.
Decided to ask any Professionals or experienced programmers out there what
to do.

How can I write the following in Visual Studio.NET and see the answer?

-Or- Is there some other way to see the answer?

Const intNumber As Integer = 10
Select Case intNumber
Case 1, 3, 5, 7, 9
intMystery = intNumber
Case 2, 4, 6, 8, 10
intMystery = intNumber + 1 * 2
Case Else
intMystery = intNumber * 2 + 1
End Select

Thanks for your help,
T

--
Warm Regards,

McRubin Bevil
mc***********@hotmail.com
972-329-3469
Nov 20 '05 #1
5 865
"Taishi" <ta********@hotmail.com> wrote...
How can I write the following in Visual Studio.NET and see the answer?


Hi... there are a number of ways to choose from. Try them and see which is
appropriate under different circumstances.

* Perhaps the first was is (if you have a form) you can drop a label on it
and set the text property as in label1.text = intMystery.ToString

* You can output the value to the output window while the program runs with
debug.writeline( intMystery )

* You can set a watch variable in the watch window (while it is running.)

* You can place a breakpoint before that code and step into the code or
place it after that code and if you place the cursor over the variable the
value will display.

* While the program is at the breakpoint (if the value has been computed
already and is in scope) you can type the following into the command window

? intMystery (and press enter)

* You can add a messagebox and have it display it.

You might test each one out just for kicks... best of luck,
Tom
Nov 20 '05 #2
Tom,

I don't understand. I placed responses below. How do I do the first
option?

Tai
"Tom Leylan" <ge*@iamtiredofspam.com> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
"Taishi" <ta********@hotmail.com> wrote...
How can I write the following in Visual Studio.NET and see the answer?

Hi... there are a number of ways to choose from. Try them and see which

is appropriate under different circumstances.

* Perhaps the first was is (if you have a form) you can drop a label on it
and set the text property as in label1.text = intMystery.ToString
I tried this way first. Maybe my coding is wrong. After I ran it, it
didn't display in the box I created on the form.

* You can output the value to the output window while the program runs with debug.writeline( intMystery )
I have no clue how to code this option.
* You can set a watch variable in the watch window (while it is running.)

* You can place a breakpoint before that code and step into the code or
place it after that code and if you place the cursor over the variable the
value will display.

* While the program is at the breakpoint (if the value has been computed
already and is in scope) you can type the following into the command window
? intMystery (and press enter)

* You can add a messagebox and have it display it.

You might test each one out just for kicks... best of luck,
Tom

Nov 20 '05 #3
"Taishi" <ta********@hotmail.com> wrote...
* Perhaps the first was is (if you have a form) you can drop a label on it and set the text property as in label1.text = intMystery.ToString


I tried this way first. Maybe my coding is wrong. After I ran it, it
didn't display in the box I created on the form.


You are going to have to solve this one... all form-based development uses
things like this. Keep in mind that the value must be assigned "after" it
has been computed. Clearly if you assign the value of the variable before
it exists or before it has been computed it won't display properly. And of
course if you never assign the value of the variable that wouldn't work
either.

Keep in mind also that you can test the assigning of text to a label control
outside of your routine just to test it. Get it to say "Hello Taishi"
before you get it to do anything else.
* You can output the value to the output window while the program runs

with
debug.writeline( intMystery )


I have no clue how to code this option.


I'm going to suggest you look up writeline in the help system. Again... you
can test it by having it output your name. If you post all of your code we
can point to the spot where you need to add this stuff.

Tom

Nov 20 '05 #4
Here is my code.

On my design form I have 2 text boxes labeled lblMystery and lblNumber.
Then I have a calculate button.

code:

Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCalc.Click

Dim intMystery As Integer

Dim lblMystery As Decimal

Const intNumber As Integer = 10

intMystery = lblMystery

Select Case intNumber

Case 1, 3, 5, 7, 9

intMystery = intNumber

Case 2, 4, 6, 8, 10

intMystery = intNumber + 1 * 2

Case Else

intMystery = intNumber * 2 + 1

End Select

lblMystery = intMystery

End Sub

End Class
Thanks for all of help,
Tai

"Tom Leylan" <ge*@iamtiredofspam.com> wrote in message
news:On**************@tk2msftngp13.phx.gbl...
"Taishi" <ta********@hotmail.com> wrote...
* Perhaps the first was is (if you have a form) you can drop a label
on
it and set the text property as in label1.text = intMystery.ToString
I tried this way first. Maybe my coding is wrong. After I ran it, it
didn't display in the box I created on the form.


You are going to have to solve this one... all form-based development uses
things like this. Keep in mind that the value must be assigned "after" it
has been computed. Clearly if you assign the value of the variable before
it exists or before it has been computed it won't display properly. And

of course if you never assign the value of the variable that wouldn't work
either.

Keep in mind also that you can test the assigning of text to a label control outside of your routine just to test it. Get it to say "Hello Taishi"
before you get it to do anything else.
* You can output the value to the output window while the program runs with
debug.writeline( intMystery )


I have no clue how to code this option.


I'm going to suggest you look up writeline in the help system. Again...

you can test it by having it output your name. If you post all of your code we can point to the spot where you need to add this stuff.

Tom

Nov 20 '05 #5
"Taishi" <ta********@hotmail.com> wrote...
Here is my code.
Notice how your code was double spaced? In the future try to paste it into
Notepad first, then cut again and drop it into your message. That will
eliminate the double spacing.
On my design form I have 2 text boxes labeled lblMystery and lblNumber.
Then I have a calculate button. Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnCalc.Click

Dim intMystery As Integer
This is a variable of type Decimal that you have chosen to name lblMystery
it isn't a label control.
Dim lblMystery As Decimal

Const intNumber As Integer = 10
This isn't doing much just assigning the zero in lblMystery (a Decimal) to
intMystery (an Integer)
and it indicates that you should Set Option Strict to "On" because it didn't
generate an error
intMystery = lblMystery Select Case intNumber

Case 1, 3, 5, 7, 9

intMystery = intNumber
Since intNumber is a constant and equal to 10 it is a safe bet that the code
here will execute
Case 2, 4, 6, 8, 10

intMystery = intNumber + 1 * 2

Case Else

intMystery = intNumber * 2 + 1

End Select
And here you have simply assigned the Integer to the Decimal variable
lblMystery = intMystery

End Sub

End Class


Note the code in my original example. You may have dropped a label onto the
form but you aren't assigning the value of intMystery to it or the code
would read as follows: lblMystery.Text = intMystery.ToString

I'd suggest that you remove the references to the lblMystery variable, check
the name of your label and try again. And go to the project setup and
change the Option Strict (in the "build" area) to "On" it will trap and
point out silly errors for you. Let the computer help you out in these
cases.

Tom

Nov 20 '05 #6

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

Similar topics

5
by: Carlos Ribeiro | last post by:
Hello all, I'm posting this to the list with the intention to form a group of people interested in this type of solution. I'm not going to spam the list with it, unless for occasional and...
0
by: Marco Alting | last post by:
Hi I have a created a cost reporting system which shows a level-breakdown report. There are three levels in the report the lowest level holds the cost items that are entered by the user these...
14
by: Vijay Kumar R Zanvar | last post by:
I have following questions: 1. Appendix C of K&R says: Trigraph sequences introduced by ?? allow representation of characters lacking in some character sets. ... Can somebody explain how...
2
by: Paul Hatcher | last post by:
I'm porting a Java app and re-structuring it slightly to put the test cases into a separate assembly from the actual code. The conversion wizard creates a file with a class called SupportClass...
20
by: hippomedon | last post by:
Hello everyone, I'm looking for some advice on whether I should break the normalization rule. Normally, I would not consider it, but this seems to be a special case. I have created an...
65
by: Chris Carlen | last post by:
Hi: From what I've read of OOP, I don't get it. I have also found some articles profoundly critical of OOP. I tend to relate to these articles. However, those articles were no more objective...
11
by: Gunter Schelfhout | last post by:
I'm starting to write a QT-program on Linux but I'm not very experienced yet. (hang on, it will be on topic) What is the best way to go to design the lower level classes? Should I use the standard...
53
by: Aaron Gray | last post by:
I jokingly say this is the late entry :) Okay I have read all the event entry comments from John's Resig's AddEvent comepition blog :- http://ejohn.org/projects/flexible-javascript-events/ ...
7
by: =?Utf-8?B?QU9UWCBTYW4gQW50b25pbw==?= | last post by:
Hi, I have been using the code (some of it has been removed for simplicity) below to allow authenticated (using ASP.NET membership database) users to get a file from their archive area. It...
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?
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.