Click here to Skip to main content
15,893,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello programmers, got a huge problem here. As you all see all i want is to save data from database whether existing goes to dropdown and if new goes to textbox. now Ive manage to bind data on dropdown using the SQL statement NOT IN and so far it works. I limit inputing by using if else statement so this is it:
Code
If txtcategory.Text <> "" And drpdwnExistingCat.SelectedValue = "" Then
txtcategory saved.. on my databases
ElseIf txtcategory.Text <> "" And drpdwnExistingCat.SelectedValue <> "" Then
 If txtcategory.Text = drpdwnExistingCat.SelectedItem.Text Then
 msgbox("error")not really my code
 else
 Saved both

Now in is working say on if else
txtcategory.text = "Trying"
drpdwnExistingCat.SelectedItem.Text = "Trying"

But when I change the letter case say
txtcategory.text = "TRYING"
drpdwnExistingCat.SelectedItem.Text = "Trying"

Both save so ive got an error. How can I fix this kind of error. Please help.

Thanks and more power.
Posted

1 solution

Well you can get both values to uppercase letters and then compare them if thats the case.

To do it you can use ToUpper() method it. For it check here on MSDN[^]

But when I check your code it seems like you are comparing the textbox value with the combobox'x selectedvalue? you only want to compare the textbox value with the combobox's selectedvalue or all the items in this combobox?

Good luck
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900