Questions tagged [select-case]

164 questions
0
votes
1 answer

Select Case Not working as expected (Code specific)

I have a while loop displaying an array of graphnodes (using a function that returns a char in the graphnodes to display) followed by a 'move' procedure that moves a "Creature" from one node to the other. The creature decides where to go by pressing…
Kijilas
  • 33
  • 6
0
votes
1 answer

Exiting a Select Case in a Subroutine

I have a issue, In my Main Tags, I functions/sub routines which follow each other once one is done. Then one of my third sub routines contains a select case, for the input 5 I want it to continue to the next sub routine, however I'm not sure on how…
user11038329
0
votes
2 answers

Select Case statement and data validation

I am trying to validate data ranges using the select case statement. I am having issues with the other nested select cases. Is this possible or am i wishfull thinking? Or should i separate the select case statements to be stacked? For instance this…
0
votes
4 answers

VB net. Morse code translator: cut correct signs using Mid() and match them with the letter

I am trying to translate Morse code into text in VB.net. Using below code, some of the letters in the text stays untranslated. I believe the problem is with "oddel" which should indicated how many letters should be cut in Mid(morsC, i, oddel), while…
Mari
  • 37
  • 5
0
votes
2 answers

Python equivalent of select case (CDec(variable)

I'm working on fixing some code in a git project, and have an issue. The program uses key-value pairs, where the value is numeric (as a String). I know how to code it in Visual Basic (or think I do), but I'm not sure how to do it in Python. If I…
0
votes
1 answer

Using Select Case to reference all rows in Named Range

I have the below worksheet change code. The current iteration I would specify the the row numbers manually in each Case which works fine. The number or rows for each case is changing dynamically by another macro which will insert or delete rows…
Chris
  • 45
  • 1
  • 8
0
votes
1 answer

How can I loop this index match?

Ok, so I have this macro here that is filling cells with an index match function in columns AB and AC. (this part is fine) Then it is meant to format those values in column AC into their correct currencies based on the information in a range called…
0
votes
3 answers

Generate options for 3rd ListBox based on 2nd ListBox selection

I wrote a simple version of a userform to pinpoint my issue. The selection of ListBox1 lstClassName determines the options for ListBox2 lstClassName (working). The selection for ListBox2 is supposed to determine the options for ListBox3 lstLanguage…
SSG
  • 13
  • 3
0
votes
1 answer

VBA for Excel - Avoid type code again if deeper select case dont match criteria

I was wondering if there is a workaround to not retype the code if a deeper select case dont' match the criteria. I have to check whether the Month is one of those stated below, if it is I have to check if the day of that month match with the…
0
votes
0 answers

Visual Basic Case Select returning last value regardless of data values

After entering an "A" worthy grade the case select is still returning an "F". I know it's simple but what's wrong here? 'perform calculations totalTest = (testScore1 + testScore2 + testScore3) / 3 * testWeight totalLab = (labScore1 + labScore2 +…
Billyin4c
  • 13
  • 5
0
votes
1 answer

vb.net checkbox invalid cast exception

I don't like to admit it but I am building a vb.net winform that requires the use of reading text fields, check boxes or radio buttons to build a sql query and return results. the sql query part works fantastically however the select case statements…
0
votes
1 answer

case statement is true but the code under the true case condition is not executed

I have an app where there are combo boxes. In these combo boxes I want units to populated automatically. I have built a code where there is select..case condition. The case statement is true but the code following the true case statement is not…
0
votes
1 answer

MS Access 2010 Module Case Statement

I am trying to perform the following function in MS Access 2010 for Birthday=5/5/1958 and getting a return value of "unknown" instead of "Dog." Any help on this CASE statement? Public Function whichChineseZodiacSign(Birthday As Date) Select Case…
TimoLV
  • 3
  • 2
0
votes
1 answer

Postgresql - Insert when select return something

Is it possible to run select query, check if row exist and then insert some values? I would like to do that in one query. I think about SELECT .. CASE .. THEN, for example: SELECT user_id, CASE when user_id > 0 then (INSERT INTO another_table ...)…
Ridd
  • 10,701
  • 3
  • 19
  • 20
0
votes
2 answers

Select Other Data in SELECT CASE

query return StudentId and HaveGift, now i want when (studentId) returned i use another select to find Student info from tbl_Students (StuName,StuLName ,... ). The SQL which return HaveGift No: CREATE PROCEDURE SelectGiftsTest @StudentId …
user7647348