locoyamaのプロフィール

@locoyama locoyama
ありがとう数10
質問数1
回答数22
ベストアンサー数
7
ベストアンサー率
77%
お礼率
50%

  • 登録日2005/03/05
  • For Each ~ .split(vbCrLf)の中で条件分岐

    VB.NETでテキストファイルを読み込み、行頭が指定の文字列だったら処理をしたいです。 下記のような感じ(だいぶ端折ってますが)でやってみましたがうまくいきません。 Dim sr As New System.IO.StreamReader( テキストファイル名 , System.Text.Encoding.GetEncoding("Shift-JIS")) Dim Buffer As String = sr.ReadToEnd '行ごとに分割して判定 For Each TextLine as String In Buffer.Split(vbCrLf)   MsgBox(TextLine)   If TextLine Like "○○○*" Then     '実行したい処理   End IF NEXT メッセージボックスの表示では正常に1行ずつ取り出せていますがIfの判定ができません。 このままでは文字列として判定の条件には使えないのでしょうか?

  • Try, Catch についての質問

    すみません!!VB超初心者です。 PriceとCostのテキストボックスにマイナスやアルファベットを記入して計算ボタンを押した場合、Errorを示すメッセージボックスを出したいのです。 ところが、このプログラムだとちゃんと正の数字を入れた場合でもエラーのメッセージボックスがでてしまいます・・・。これはなぜなのでしょうか?よろしくお願いします! Dim priceDecimal, costDecimal, answerDecimal As Decimal Try priceDecimal = Decimal.Parse(txtprice.Text) costDecimal = Decimal.Parse(txtcost.Text) answerDecimal = Decimal.Parse(lblcomission.Text) Try txtprice.Text = priceDecimal < 0 txtcost.Text = costDecimal < 0 Catch priceException As FormatException MessageBox.Show("You have entered Invalid Data.", "Error", MessageBoxIcon.Exclamation) End Try Catch costException As FormatException MessageBox.Show("You have entered Invalid Data", "Error",MessageBoxButtons.OK, (MessageBoxIcon.Exclamation) End Try answerDecimal = Commision_rate_Decimal * (priceDecimal - costDecimal) lblcomission.Text = answerDecimal.ToString("C") End Sub

  • Try, Catch についての質問

    すみません!!VB超初心者です。 PriceとCostのテキストボックスにマイナスやアルファベットを記入して計算ボタンを押した場合、Errorを示すメッセージボックスを出したいのです。 ところが、このプログラムだとちゃんと正の数字を入れた場合でもエラーのメッセージボックスがでてしまいます・・・。これはなぜなのでしょうか?よろしくお願いします! Dim priceDecimal, costDecimal, answerDecimal As Decimal Try priceDecimal = Decimal.Parse(txtprice.Text) costDecimal = Decimal.Parse(txtcost.Text) answerDecimal = Decimal.Parse(lblcomission.Text) Try txtprice.Text = priceDecimal < 0 txtcost.Text = costDecimal < 0 Catch priceException As FormatException MessageBox.Show("You have entered Invalid Data.", "Error", MessageBoxIcon.Exclamation) End Try Catch costException As FormatException MessageBox.Show("You have entered Invalid Data", "Error",MessageBoxButtons.OK, (MessageBoxIcon.Exclamation) End Try answerDecimal = Commision_rate_Decimal * (priceDecimal - costDecimal) lblcomission.Text = answerDecimal.ToString("C") End Sub

  • Try, Catch についての質問

    すみません!!VB超初心者です。 PriceとCostのテキストボックスにマイナスやアルファベットを記入して計算ボタンを押した場合、Errorを示すメッセージボックスを出したいのです。 ところが、このプログラムだとちゃんと正の数字を入れた場合でもエラーのメッセージボックスがでてしまいます・・・。これはなぜなのでしょうか?よろしくお願いします! Dim priceDecimal, costDecimal, answerDecimal As Decimal Try priceDecimal = Decimal.Parse(txtprice.Text) costDecimal = Decimal.Parse(txtcost.Text) answerDecimal = Decimal.Parse(lblcomission.Text) Try txtprice.Text = priceDecimal < 0 txtcost.Text = costDecimal < 0 Catch priceException As FormatException MessageBox.Show("You have entered Invalid Data.", "Error", MessageBoxIcon.Exclamation) End Try Catch costException As FormatException MessageBox.Show("You have entered Invalid Data", "Error",MessageBoxButtons.OK, (MessageBoxIcon.Exclamation) End Try answerDecimal = Commision_rate_Decimal * (priceDecimal - costDecimal) lblcomission.Text = answerDecimal.ToString("C") End Sub

  • ショートカットキーの変更をしたい

    VB.NET2003で開発中です。 フォームにコンボボックスを配置して、ファンクションキーのF4を押すと、ドロップダウンリストが表示されますが、これを別のキーに割り当て、F4キーを別の処理でしよう出来る用にしたいのですが方法が分かりません。 Windows標準のショートカットキーを変更する方法は無いのでしょうか。