0
Dim charArray() As Char = randomWord.ToCharArray 'Splits the selected words into individuals strings in a array
Letter1.Text = charArray(0) ' Changes each label into its corresponding character from array
Letter2.Text = charArray(1) '*
Letter3.Text = charArray(2) '*
Letter4.Text = charArray(3) '*
Letter5.Text = charArray(4) '*
If randomWord.Contains(answer) Then 'if random word contains the users input
MessageBox.Show("You are correct!")
Correctcounter()
winorLoss = "won"
highScore()
Userinput()
それぞれ5文字の単語の文字に対応する5つのラベルが設定されています。私は、ユーザの入力(変数 答え)が変数randomWordに存在する場合、変数randomWord内の対応する単語が対応するLetter.textとして設定される方法を探しています。したがって、ユーザの入力が単語「juicy」に存在する「j」である場合、第1のラベルは「J」を表すように変化する。貧弱な書式設定には申し訳ありません。文字列内の対応する文字
'String.IndexOf'は特定の文字または部分文字列がどこにあるかを示しますが、そのコードではすでにLetter1に表示されていませんか? – Plutonix
"juicy"を含む変数randomWordを追加するのを忘れてしまい、配列を循環して単語を選ぶので、単語が "hello"や "goodbye"といったジューシーなものではないかもしれない " – AESTHETIC
プールにJUICYとBANJOが含まれているとどうなりますか?2か所で表示しますか?文字列が含まれている場合は 'String.IndexOf'が表示されます。もしそうなら、 – Plutonix