Select Case To Check If A Variable Contains " The "?
Feb 3, 2011
I am trying to do a select case to see if a variable contains a list of the most common words in the English language.[CODE]....
Right now I get the hateful blue squiggly under b.contains with a message that overload resolution failed because no accessible 'contains' accepts this number of arguments. Any suggestions? Also this is my fourth thread is it better to make new threads as new questions come up or just role from one topic to the next during a project in one thread? I just don't want to make anyone mad for starting too many threads.
I have 10 checkboxes on my screen. I have a variable setup called "case" as a string. I want to know how I can say: If checkbox1 is checked then case would be equal to "this". If checkbox2 is checked then case would = "that" Example of something I tried to cook up but didn't work because it tells me that I can't only use this in a "select case".
Dim Case as string If checkbox1.checked = true case = test1 end if If checkbox2.checked = true [Code] ......
I'm using some VB.Net code to manipulate files on my system - the idea is that the code checks if a file exists, and based on a value read from a text file elsewhere the system decides what to do... For this I'm using a 'select... case' statement to decide on the action to take. However, when assigning a value to the variable, the code doesn't even find the option to go for... Here's the VB code:
i need to check whether a demical is 0 through 49.99 or 50 through 99.99 or 100 through 199.99 or greater than 200. i am trying to do this with select case, but i am not sure of the syntax.
I need to create a Select Case statement to assign the per check processing fee:user inputs number of cks into textbox that i need to validate the input if user puts in a negative amount.
10 cents for <=20 cks written ea month 8 cents <= 20 to 39 cks written ea mo 6 cents <= 40 to 59 cks written ea mo 4 cents for 60 or more cks written ea mo.
Also, I have a label programmed to display the $10 monthly fee thats has to be included into the: Total monthly fees. Here's the coding I have so far:
Const decSERVICE_FEE As Decimal = 10D Const decTWENTY_OR_LESS_CHECKS As Decimal = 0.1D Const decTWENTY_THRU_THIRTYNINE_CHECKS As Decimal = 0.08D
I have an app that adds ammount to gether and i am trrying to do some error checking. This is the code i Have so far
CODE:
I would like to turn this into a select case so that it calls all the code need to check before running. I have tried to do it my self but has been ages since i coded and even then it was in VB6. I know there is a way to do the case in a module and then call it into the form where i need it. i have 3 radio buttons that if they are not selected it pops up a message to say so.
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?
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
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.
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.
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
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
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?
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.
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.
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?
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
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]...
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"
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
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.