if user input "a" or "a" .. output apple. work in letters "b" "c" , fort... where/how should put and/or operator?
private sub txtchange_change() if txtchange.text = "a" lbloutput.caption = "apple" elseif txtchange.text = "b" lbloutput.caption = "banana" elseif txtchange.text = "c" lbloutput.caption = "cat" elseif txtchange.text = "d" lbloutput.caption = "dog" else lbloutput.caption = "not found" end if end sub
for simple .. use select case
private sub txtchange_change() select case ucase(txtchange.text) case "a" : lbloutput.caption = "apple" case "b" : lbloutput.caption = "banana" case "c" : lbloutput.caption = "cat" case "d" : lbloutput.caption = "dog" case "red" : lbloutput.backcolor = rgb(255, 0, 0) case else lbloutput.caption = "not found" end select end sub
Comments
Post a Comment