次のコードを使用して、イメージ名を .TXT ファイルに送信するコンパイラを作成しようとしています。このファイルは、後で別のプログラムで読み取ってオーバーワールド マップを作成できます (古い NES ゼルダ ゲームのように)。問題はオンです。 16 行目 (スペースを数えない場合は 15 行目) プログラムがイメージ名を送信しているビットに到達すると、次のエラーが返されます。
「演算子 '&' は文字列 "Me.BackgroundImage = WindowsAppl" およびタイプ 'Bitmap' に対して定義されていません。」
この問題を解決するにはどうすればよいですか? ファイルに取り込まれる前に、コンパイラがコードを読み取っているように見えます。
ありがとう!リアム・ハケット
'Saves the map into a .TXT file
Dim mydocpath As String = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
Dim sb As New StringBuilder()
'Used to manage compiler
Dim MLN As Byte
Dim FC As Boolean = True
'Two "FOR" loops one for the Horizontal axis for the map and one for the Verticle axis
For x = 1 To 10
For y = 1 To 10
'On first loop
If FC = True Then
sb.AppendLine("If WorldHorizontal = " & x & "And WorldVerticle = " & y & " Then")
sb.AppendLine("")
MLN = MLN + 1
sb.AppendLine("Me.BackgroundImage = WindowsApplication1.My.Resources.Resources." & MapLayout(MLN).Image)
sb.AppendLine("")
FC = False
'Everyother loop
Else
sb.AppendLine("ElseIf WorldHorizontal = " & x & "And WorldVerticle = " & y & " Then")
sb.AppendLine("")
MLN = MLN + 1
sb.AppendLine("Me.BackgroundImage = WindowsApplication1.My.Resources.Resources." & MapLayout(MLN).Image)
sb.AppendLine("")
End If
Next
Next
' Saves file in MyDocuments
Using outfile As New StreamWriter(mydocpath & "\" & txtbFileName.Text & ".txt")
outfile.Write(sb.ToString())
End Using
MsgBox("Compile Finished")