Built Into A Select Case Contained Within A Module?
Nov 10, 2009
I'm looking to turn this vb calculator I built into a select case contained within a module. I'm not sure where to start if someone could help.
Public Class form_calc
Dim firstEntry As Double 'Declares the variable for the first entry
Dim secondEntry As Double 'Declare the variable for the second entry
Dim operation_sign As String 'Declares the variable for the math sign
Private Sub form_calc_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
display.Enabled = False
[Code]...
View 6 Replies
ADVERTISEMENT
Nov 25, 2009
I've got a console app with a sub main then i have a seperate class inside the module..i can't seem to update the public global variable from inside the class as i can't declare the variable as shared...
View 6 Replies
Feb 1, 2011
I have "added an existing project" to my solution. This item has been used in several different solutions but I am running into an issue for the 1st time w/ it.
I have 2 applications:
X & Y
I copied the "existing project" from the X folder to the Y folder (so I would not be altering the same "existing project". Then I "added" the project from the new Y location. I also added reference to the DLL file in location Y. However when I debug from program Y it keeps running the code from location X. Everything that I know to look at looks correct. Any ideas on what is causing the issue and how to resolve it?
FYI, To prove the point I changed the folder name for testing in the X folder. When I then debug program Y i get this error:
Source file: C:VB_FIlesYY"ExistingLibrary""Existing".vb
Module: C:VB_FilesYYinRelease"ExistingLibrary".dll
Process: [4416] Y.vshost.exe
The source file is different from when the module was built. Would you like the debugger to use it anyway?
View 4 Replies
Mar 29, 2010
When I start the debugger,there is a message that contain the source file is different from when the module was built. would you like the debugger to use it anyway? how to solve that thing? and also, i can not use the breakpoint there is a sign like triangle and "!" and it says that"the breakpoint will not currently be hit. the source code is different from the original version."
View 7 Replies
Mar 21, 2006
When my form loads it adds some handles (using AddHandler) to a sub (showStatus). What this sub does is checks which control activated the sub (using sender.Equals) and displays text in the status label (status) accordingly.For this I use an If...Then statement for each possibility. There are many possibilities and my code get cluttered. Is there a way to do the same thing with a Select...Case statement. I tried: Select Case sender Case tbOne : status.Text = "blahblahblahblahblahblah" End Selectwhere: tbOne is a textbox, status is a StatusLabelIt gives me an error though, saying "Operator '=' is not defined for types 'Object' and 'System.Windows.Forms.TextBox'."Any ideas on how I can get this to work with a select case statement?
View 13 Replies
Oct 20, 2009
here is my code..
[Code]....
If the result is 86 and it's mod by 43 the answer is 2 Case 2 is not firing. it just goes to the end of the procedure.
View 4 Replies
Oct 28, 2009
i have a program using a select case to convert letters to special charaters. My question is how can I get the code to read upper and lower case letters without having to put the upper case letters in my select case statement. Example: Part of my code is
[Code]...
View 6 Replies
Oct 31, 2010
ive got a form containing treeview on the left docked, and two panels one over the other (just as for practice), so i am using treeview to select one from the other the code contains the Case select,
If
Not e.Node
Is
Nothing
[code]....
The problem is , both panels are not visible, when i select the first node the firstpanel is visible then i select the second node both panels are not visible, i return to the first node the first panel is visible.
View 2 Replies
Feb 4, 2011
i have encountered a problem, i want to access the data coming to the computer from the in-built bluetooth module of a computer on windows platform, this data has been sent by a remote bluetooth module say a by an autonomous device (just like a bluetooth mouse connecting to the computer). The to be sent is in the form of numbers and i need these to manipulate on the computer.
View 6 Replies
Oct 28, 2010
[code]I don't get any error messages, but the DoSomething() line is never executed. I guess this isn't possible.
View 7 Replies
Jan 3, 2011
I'm working on a routine that requires a significant amount of nested and daisy-chained logic. Using If-Then-Else, each logic construct would run 8-15 lines of code (quite readable) while using Select Case each construct doubles that (even with significant commentation, it gets less and less readable with each new Case).
I've read many times in this forum how Select Case is leaps and bounds ahead of If-Then-Else in runtime performance, although I can't recall any discussion of the underlying process(es) that make it so. I've also not had any luck finding good, detailed documentation on the nuts and bolts under each logic construct. What I'm working on, if the performance leap is legit, needs the performance more than the readability but if the performance is marginal then the readability is going to get the priority. how and why Select Case is supposed to process so much faster than If-Then-Else. Links to good white paper would be really nice too.
View 1 Replies
Jun 12, 2011
I have a macro that uses "If Then" to choose what macro to run based on the ActiveCell. I would like to use the Select Case method instead. How would I change this code?
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application.DisplayAlerts = False
Application.ScreenUpdating = False
[Code].....
View 1 Replies
Apr 11, 2011
Question is, I basically wrote a Rock Paper Scissors game in VB.NET using If statements and wondered how exactly I would try and work this into a Select Case instead.Professor was pretty awful at teaching things and didn't let us know until today that it had to be Select Case(its due tomorrow
View 2 Replies
Apr 3, 2012
Converting an IF THAN ELSE into a select case
View 4 Replies
Nov 30, 2010
I am convertng vb.net to c# 2010 as my job, and none of the automatic tools I have can succeed completely. In special example, this case:
[Code]...
I am mostly java developer before this, so not great with c# and none with vb.net. I do not understand the "oaaaa to" part and this part is not converting. Can you please point me to right place to find the c# version of this?
View 3 Replies
Aug 26, 2009
I have an if-elseif-then setup as below:
Private Sub CommandButton1_Click()
If OptionButton1.Value = True Then
getdate
Unload glpmenu
[Code] .....
I would like to change to Select Case.
View 3 Replies
Mar 24, 2011
i think this is the right place to post this.so i am doing my First Vb project and have run into some problems
[Code]...
View 7 Replies
Jan 26, 2009
I am using visual basic in VS 2008 and trying to learn how to assign a value to a word in a combo box using case select, this is my first attempt at programing and i just can't work out what to do next. So far i have two combo boxes a label and a button, i want the word, first to = 11, second = 9, third =7, fourth = 5. All it is doing at the moment is adding the list index value and displaying that total in the label. I want it to display for eg: if (first=11) and (second=9) are selected a total of 20 in the label,and so on for what ever combination is selected.
[Code]...
View 4 Replies
Aug 18, 2009
I have assigned nodes in my treeview keys depending on what they are to do with and now i would like to use a select case to choose the right calculation depending on which node is selected.i have tried selecting the key like this:
Select Case tvwFCOM.Nodes.IndexOfKey(tvwFCOM.SelectedNode.Text)
Case Is = "assi06"
Call MinimumSpeeds()
but option strict on dissalows conversion from string to integer. there are more cases, but i have only shown one here. How can i code so that the key is selected from the selected node?
View 6 Replies
Jan 27, 2010
I had to change the given code from If Then to Select Case, and this is what I came up with. But when I run the program, it does not work and gives me zeroes instead of the correct information.
Public Class MovieInfo
Private wkndBox, screens As Integer
Private title As String
[Code].....
View 4 Replies
Jun 3, 2011
I just replaced a different segment of code with the select case statement and it works fine. However I don't understand what the dim is for after you do "Select case [variable name here]"
I currently just dimmed a value as nothing. I didn't specify any data type for my variable I'm using for this case statement. But it works.[code]...
View 4 Replies
Jun 16, 2009
Enum age
Over18
Under18
End enum
[code]....
'age' is a type and cannot be used as an expression.Is there any way of using enums in "select case"?
View 5 Replies
Nov 8, 2010
I am in my programming class and we had a small program to make that would check to see if an value that was entered is a integer and convert it to a Roman numeral. I know how to properly do it by putting the TryParse into the If...Then statement. What I am trying to do is to not use an If...Then statement and go just by a Case Selection statement. If it is not possible then that is cool with me, I am just trying to think outside the box. Here is what i have done with it:
[code]....
When you do say "Case 1" it says it needs to be "Case CBool(1)." Using either "Case CBool(1)" or "Case 1 = 1" provides the same result .However the code shows no errors it doesn't do the conversion, it always displays the label's value as "I"
View 3 Replies
May 1, 2009
I have a question regarding a null value which I am not supposed to get in VB. Here is my code.
Public Class SelectDemo
Private Sub lstData_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstData.SelectedIndexChanged
[code].....
View 2 Replies
Oct 18, 2009
i need to make a statement that checks the remainder of a number divided by 4.[code]can i get this in SELECT CASE ..MOD format please
View 1 Replies
Jun 15, 2011
Select Case currentNodeName
Case "string1","string2","string3","stringEtc"
Case Else
[Code]....
The above is a code snippet... of course I've already made my declarations earlier in the code. My issue is I get the error " 'Select Case' must end with a matching 'End Select'." It looks to me like VB is not liking my If statement with the "Next For" in the middle. I'm sure this is a basic syntax issue.
View 3 Replies
Jul 30, 2010
I have say 4 asp.net radiobuttons which are grouped, I want to find out which one is checked.
What seems natural to do is:
Select Case RadioButton.Checked = True
Case myRadioButton1
Case myRadioButton2
Case myRadioButton3
Case Else
End Select
I just get a 'reference to a non-shared member reference' error. It's a shame because it seems such a clean way to do this test.. Is it possible??
View 3 Replies
Dec 14, 2009
I made an application that calculates course grades. The program runs perfectly except for the last part
The the final grade number comes from the label "lblCoursePts" and i want to put the letter grade in the label "lblFInalGrade" Here is what i have.
'Determine the final letter grade
Select Case lblCoursePts.Text
Case 90 To 100 : lblFinalGrade.Text = "A"
[Code]....
View 5 Replies
Dec 17, 2011
I've got the following that has got multiple values of a particular variable and I don't want to stack up to a lot of IF ELSE statements to handle them, so I'd be grateful if some one could very kindly modify the code by using the SELECT CASE statement. Also, I'd like dgMarksEntry.Item(7, i).Value and dgMarksEntry.Item(8, i).Value to handle RANK and COUNT the number of items entered respectively. [Code]
View 2 Replies
Feb 18, 2010
I found this code on here while doing a search and would like to be able to use it but it was written in C and I dont know much about that (don't know that much about VB.NET either but trying to learn)[code]What I do have is a text box where a user enteres a desired number of US dollars to convert to three types of currency.I know how to convert the string entered to an integer so the calculation can take place. What I don't know how to do is modify the above code so that the results will show up in the correct text boxes after each calculation (yes I know I have to convert the integer back to text).If someone could show me how to do the first Select Case I can figure the rest out.
View 12 Replies