作成日: 2026/03/25 最終更新日: 2026/03/25
文書種別
使用方法
詳細
StrConv関数を使用して文字列の全角/半角を変換できます。
[Strings.StrConv メソッド (Microsoft.VisualBasic) | Microsoft Docs]
https://docs.microsoft.com/ja-jp/dotnet/api/microsoft.visualbasic.strings.strconv
[VbStrConv 列挙型]
https://docs.microsoft.com/ja-jp/dotnet/api/microsoft.visualbasic.vbstrconv
ページレポート/RDLレポートの場合
StrConv関数を実行する独自の関数をスクリプトに定義し、それを呼び出す式をTextBoxのValueプロパティに設定します。
◆サンプルコード(スクリプト)
Function StrConv2(ByVal str As String, ByVal type As Integer)
Return StrConv(str, type)
End Function◆Valueプロパティの記述例
=StrConv2(Fields!fieldName.Value, 4) ※全角
=StrConv2(Fields!fieldName.Value, 8) ※半角
セクションレポートの場合
TextBoxを配置しているセクションのFormatイベントで、Textプロパティの文字列をStrConv関数で変換します。
◆サンプルコード (C#)
using Microsoft.VisualBasic;
private void detail_Format(object sender, EventArgs e)
{
textBox1.Text = Strings.StrConv(textBox1.Text, VbStrConv.Wide);
textBox2.Text = Strings.StrConv(textBox2.Text, VbStrConv.Narrow);
}