Publicクラスの外に以下のように宣言
Imports Microsoft.VisualBasic.FileIO Public Class Form1
実際のファイルの読み込み
Dim i As Integer Dim Fname As String Dim tfp As New TextFieldParser(Fname) tfp.TextFieldType = FieldType.Delimited tfp.SetDelimiters(",") Dim sreadData As String() i = 0 While tfp.EndOfData = False sreadData = tfp.ReadFields() ID(i) = sreadData(0) Data(i) = sreadData(1) i = i + 1 End While
Dim cmds() As String Dim i as integer '配列に引数を取得 cmds = System.Environment.GetCommandLineArgs() Dim bcmd(UBound(cmds)) As String '順番にbcmd(0)には実行パスのフルパス bcmd(1)には第一引数、の順に入る For i = 0 To UBound(cmds) bcmd(i) = cmds(i) Next i
VB6以前と互換的には
Dim sepa As String = " " Dim commands As String = Microsoft.VisualBasic.Command() commandsにはVB6のときのようにコマンドライン全部が入る Dim args() As String args = commands.Split(sepa.ToCharArray) Dim bcmd(UBound(cmds)) As String '順番に bcmd(0)には第一引数、bcmd(1)には第2引数 の順に入る For i = 0 To UBound(args) bcmd(i) = args(i) Next
If e.KeyChar = Chr(13) Then Label5.Text = Str(sum) & "円" sum = 0 TextBox1.Text = "" End If