掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
.NET2003 で構造体からString変数へのコピー (ID:84810)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
魔界の仮面弁士さん、お返事ありがとうございます。 >http://madia.world.coocan.jp/cgi-bin/VBBBS/wwwlng.cgi?print+200406/04060083.txt 上記のURLを参考に、以下のようにプロパティと連結用メソッドをTestStructに実装して対応することができました。 --------------- Structure TestStruct Private _resCode As String Private _updMode As String ' resCodeプロパティ Property resCode() As String Set(ByVal Value As String) _resCode = LSet(Value, LEN_RESCODE) End Set Get Return _resCode End Get End Property ' updModeプロパティ Property updMode() As String Set(ByVal Value As String) _updMode = LSet(Value, LEN_UPDMODE) End Set Get Return _updMode End Get End Property ' プロパティに設定されている文字列を全て結合する Public Function getSendBufferJoin(ByVal testStruct As TestStruct) As String Dim T As Type = GetType(TestStruct) Dim strBuf As New String("") For Each F As Reflection.PropertyInfo In T.GetProperties() strBuf = strBuf & F.GetValue(testStruct, Nothing) Next Return strBuf End Function End Structure --------------- 実動作は富士通ホスト機とのバッファ送受信になるので、Byte型でのやりとりになりますが、全体的な動きを理解することができました。 どうもありがとうございました。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.