Questions tagged [select-case]
158 questions
2
votes
5 answers
VB.NET Select Case - what is the correct statement?
Why doesn't the following code work?
Private Function resolveSiteName(ByVal plantName As String, ByVal siteName As String) As Integer
Dim siteId As Integer = Nothing
Dim fullName As String = plantName & siteName
Select Case fullName
…
Brandon
- 895
- 4
- 21
- 43
1
vote
2 answers
SQL Local Variable
I use SQL Server 2005 and I have a query like this :
INSERT INTO [subject] ([sch_id],
[subj_from],
[subj_to],
)
SELECT
CASE
WHEN (SELECT @sched = [sch_id]
FROM [schedule]
WHERE…
ELM
- 519
- 1
- 5
- 19
1
vote
3 answers
Convert VBA select case to C#
Select Case True
Case Not A.Name Is Nothing
Set Name = A.Name
Case Not A.Age Is Nothing
Set Age = A.Age
Case Not A.School Is Nothing
Set School = A.School
End Select
In VB Select Case True is allowed to use. But for C# it gives an…
Ramesh Perera
- 53
- 5
1
vote
2 answers
Is there a more concise way of using Select Case here?
I'm testing an input to see if it consists of Japanese characters, which fall within a certain unicode block. I could do it with If, but I like the neater syntax for Select Case. Said that, I'm not quite sure how to write a "Case" that excludes…
Lou
- 1,641
- 18
- 52
1
vote
1 answer
Select inside a where statement
I just want to make sure I am doing this right.
I have two tables:
Customer:
ID: GUID
name: varchar
... etc
and Reference
ID: GUID
customerid: GUID ----> FK
Myreference: varchar (max)
timestamp: datetime
I have the following stored procedure which…
Alex Mouses
- 15
- 3
1
vote
1 answer
How do I assign the return value of a case statement to the cell to the right of the current cell in a For loop?
Background
In VBA, you can assign the return value of a Select Case statement to specific cells as shown below:
Add the Select Case structure.
Select Case score
Case Is >= 80
result = "very good"
Case Is >= 70
result =…
isakbob
- 1,150
- 1
- 9
- 31
1
vote
1 answer
VBA: Coloring chart series with "Select Case"
I am pretty new to VBA thus some help on this is highly appreciated. :)
As the question header shows I tried to give every serie in my chart a different color. What I got so far works well but with a small limitation. The names of the series changes…
Jashi
- 13
- 5
1
vote
1 answer
Case Without Select Case for String Cases
I am trying to select a different case for each different string combination that can be passed in. In this case I'm using abbreviations for baseball positions.
To make it easier I have added a String value called "Position" to be what is…
obizues
- 1,275
- 4
- 13
- 29
1
vote
2 answers
Access, Select Case ActiveControl.Name?
i have 2 combo boxes (c1, c2) in a form access, with button Search , if a user choose a value from c1 and click on Search it should open a FORM1, and if the user choose a value from c2 and click on Search it should open FORM2.
Private Sub…
Jamila
- 31
- 1
- 10
1
vote
0 answers
Excel cells to be amend through VBA script only
I have a vba script i am working on. It applies a time stamp each time the relevant cell is double clicked. Once its double clicked the cells are locked.
When the cell is double clicked on again a pop up box appears requesting a password, which is…
James
- 481
- 3
- 11
- 32
1
vote
1 answer
VBA Select Case is multiple criteria
I have the following piece of code and would like to modify it a bit. Basically with every case is i want to check a secondary criteria. For example Case is = "Lottery" i want to add on AND range("SalesChannel").value = "SMB". i would then like to…
Peter Mogford
- 264
- 1
- 3
- 11
1
vote
1 answer
Select Case conversion not displaying properly, how can i fix?
I have an executable that when run takes an inputted date and then selects what date suffix is needed with it, however it is always defaulting to the case else.
when i have 02/04/2017 as format DD/MM/YYYY the result of the below case is 2th April…
Danny James
- 234
- 3
- 15
1
vote
2 answers
Select Case on a range
I basically have multiple variables that I want to categorize. I have a list of which variable goes into which category however given I have 40,000 entries doing it manually would be timely.
Basically my data is such that a,b,c are in Group A,…
Isra Shaikh
- 127
- 3
- 12
1
vote
1 answer
how to use concat function in case statement using jpa criteria query
Iam concatenating string and expression in case statement when the condition is satisfied as below mentioned code.
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery
Bhagya Lakshmi
- 19
- 1
1
vote
4 answers
How can I do select case to this query?
SQL FIDDLE DEMO HERE
I have this structure of tables:
CREATE TABLE Users
([UserId] int,
[IdDepartment] int);
INSERT INTO Users
([UserId], [IdDepartment])
VALUES
(1, 5),
(2, 0),
…
Esraa_92
- 1,481
- 1
- 15
- 43