Make A 'like' Statement Or Use Some Kind Of Wildcard To Make The Statement Not Case Sensitive?
Jul 11, 2010
I'm building a listview search feature in my app. (See the code below). It works really well, except if you search "T" then the code removes all items, if you search "t" then it removes every item except for those starting with "t". Is there any way to make a 'like' statement, or use some kind of wildcard to make the statement not case sensitive?
For Each itm As ListViewItem In ListView2.Items
If itm.Text Like TextBox1.Text & "*" Or itm.SubItems.Item(1).Text Like TextBox1.Text & "*" Then
Else
I have the following code that verifies user id and password, which are retrieved from SQL Server, but I want the verification of the password to be case sensitive.
I have coded a case statement that changes the background colour of a panel. [code]When the code is run, it works for the case of colour1 that is NOT 1 or 2. However, when the colour1 is 1 or 2, it is supposed to pick a number from set array and run another case statement. Instead, it only picks the last value (for 1, this is 5, and for 2, this is 7).
How do I create a Login Verification routine (Login Form) and make the password case sensitive?Please remember to mark the replies as answers if they help and unmark them if they provide no help.
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 query here run in SQL server 2008 which produces the error "Conversion from string "INSERT INTO Faculty (emp_id, lna" to type 'Double' is not valid."
I am trying to make an If statement. I have 4 radio buttons
Part Time Full Time Part Time Temp Full Time Temp.
I am calculating Fringe and Calucalted Funds.I also have 6 constants
Const PEIABasic_RATE_Decimal As Decimal = 5.06 Const PEIAFAMILY_RATE_Decimal As Decimal = 778.0 Const WORKERSCOMP_RATE_Decimal As Decimal = 0.0049D
[code]....
I have two text boxes where a user can enter the hours worked and hourly rate. and Salary rate. If a user clicks the Full time radio button the calculation for fringe should be FICA const * salary Works comp const * salary.Then u would add the fringe to the base salary. Part time the user needs to click the part time button along with another button, either TIAA or State REtierement.
If FullTimeTempButton.Checked & TIAARadioButton.Checked Then FringeTextBox.Text = (FICA_RATE_Decimal * SalaryTextBox.Text) + (WORKERSCOMP_RATE_Decimal * SalaryTextBox.Text) + (TIAA_RATE_Decimal * SalaryTextBox.Text)
i want to make condition statement in my function. i use this method : [code]if i try to insert a data already in the database, the function will directly go to the updateDatabase()the problem is, if i try to insert the data that currently not in the database, the function will directly go to update database as well.
i need a update statement to make a record = 1 example : the colum what need to change is active and it must stand on 1 to show you in to a listview (that part works) but i need to do it manualy to make them active now i liked to when the login is a succes then the record = 1 for you this is my code :
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim adapt As MySqlDataAdapter Dim sqlquer = ""
[code].....
i get this error : Object reference not set to an instance of an object.
i want to make crystal report of profit and loss statement i have a column of "vr_type" and there are 4 types in it "sale invoice", purchase invoice" now i want that put a 4 formula s where i select that "sum (vr_detail.debit) where vr_detail.vr_type} sale invoice it make Sum of al these types so kindly tell me what formula i should use to get the result in simply i want sum of sale,sum of purchase,sum of expense?
Public Sub sqlUpdate(ByVal table As String, ByVal column As String, ByVal var1 As String, ByVal column1 As String, ByVal var2 As String) Public CN As New MySqlConnection Public cmd As New MySqlCommand
[CODE]...
Which is fine, if I want to use mysql update all I have to do is call something like: sqlUpdate("test", "test", 0, "test", test) I was wondering if I could do the same with the SELECT statement and make a function. I cant think of a way to do it though...
sqlConnect() Dim cmd As New MySqlCommand With cmd .CommandText = "SELECT * FROM users WHERE username=""" & lblAccountName.Text & """"
[CODE]...
The data I would want to extract would be different every time.
Firstly Case 2 runs. Throws exception. And right after this debugger shows that next processed statement is Case Else. Only after Case Else throws own exception Catch block start working. I've never seen this trick. Why can this happened?I'm sure the block is entered once (not like this:first enter hit Case 2 and second hit Case Else).
Update:-To Matt Wilko. Thank you for answering. I've switch to Strict On in Options of VS2010 but nothing has changed. Command is variable, not function. Watch tool shows that on each step Command is the same ( Command = 2).
Fixed. Yeeaaaahhh. I simplefy code to Try Select Case 2 Case 2
[code]....
and change project to Console app. This works as I mention. The fix was in Release mode. I was debugging in Release mode. When I switch to Debug mode everything goes as it should.
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
I am not sure what to do with the following. The code below reads from a massive list of phrases, checks for a certain conditions and if all succeed a) adds the output to the new_question list b) keeps the value of the variable incremental to "level_0".
If the fourth "if statement" fails, the code changes the value of the variable incremental to "level_1" and jumps to a second case statement. The problem is that for certain input the code fails form the "third if statement" and execution refuses to jump to "level_1" (bacause the fourth "if-statement" must fail as well). I tried moving the "incremental variable" between the third and the fourth "and if" but since the code reads from a list of phrases even if it returns true, execution jumps to level_1 (as some phrases fail from the third "if statement"). I hope I am making sense
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 was reading an interesting article here and it made an interesting point about the 'case' statement in vb.net vs the 'switch' statement in C#, which I've pasted below:The following Visual Basic Select Case statement can't be represented in C# with a single switch statement:
Dim Condition As Integer = 55 Select Case Condition Case 1, 3 To 5, 10, 12, 14, Is > 50
[code]....
I've always found the switch statement in C#, with dropthrough and consequentrequirements for a break in each case, to be a bit unwieldy. Is there any reason they haven't enhanced the switch command to allow these situations? W
EDIT AFTER CLOSE: I'm surprised this was closed, really. With the number of extension methods and helper classes I've found online for other things, I thought an enhanced 'case' would be a good chance. I somewhat hoped a luminary such as Jon Skeet may have commented on the background reasoning, rather than the individuals below who've obviously thought 'religious debate' as soon as more than one language is mentioned.
I am having difficulties getting a case to behave like I want it to. I have to calculate income tax using a case statement. For example if someone makes $7000 or less then they are charged a 10% tax of their input income, if they make $7000 to $30,000 it will bee 10% on $7000 and 15% on the remainder of input income and so on and so forth.determining how to set up a functioning case statement like this?
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]