VB Select case not working
I started writing program which takes text and encodes It into image. I started implementing checking each character and then It writes the color onto the bitmap.
The program works fine, but when i implement
Select case then the program stops working at select case, but throws no exception.
The thing is that
MsgBox("done") never gets executed.
Dim bitmap As New Bitmap("C:\abcimage\templ.jpg") Dim input = InputBox("What do you want to encode into image?") Dim characters As Array characters = input.ToCharArray Dim Width As Int32 = bitmap.Width Dim Height As Int32 = bitmap.Height Dim textcord As Integer = 0 For y As Int32 = 0 To Height - 1 For x As Int32 = 0 To Width - 1 If textcord > Len(characters) Then bitmap.SetPixel(x, y, Color.Black) Else Select Case characters(textcord) Case "a" Or "A" bitmap.SetPixel(x, y, Color.FromArgb(255, 255, 128, 128)) End Select End If textcord += 1 Next Next MsgBox("Done") bitmap.Save("C:\abcimage\outputs\asdf.jpg")
Edit: I even tried
If, but that doesn't work either.
Case "a" Or "A"
should be this:
Case "a", "A"
If you'd read the documentation for
Select Casethen you would have seen that.
Sorry for overclocking your brains today, but the problem was with the indexation of string, I forgot it starts with 0.