我只是想轉換VB6功能VB.Net之一,下面就是我面臨的問題從VB6到VB.Net
Option Strict Off
Option Explicit On
Imports Microsoft.VisualBasic.Compatibility.VB6
Imports System
Imports System.Runtime.InteropServices
Module FunctionCmd_Msg
Public FunCommand_Msg As Fun_CommandMessage = Fun_CommandMessage.CreateInstance()
'Function Command Message
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto)> _ _
Public Structure Fun_CommandMessage
<VBFixedString(1)> Public one As String
<VBFixedString(1)> Public two As String
<VBFixedString(3)> Public three As String
Dim five As String
<VBFixedString(8)> Public four As String
Public Shared Function CreateInstance() As Fun_CommandMessage
Dim result As New Fun_CommandMessage
result.one = String.Empty
result.two = String.Empty
result.three = String.Empty
result.four = String.Empty
result.five = String.Empty
End Function
End Structure
End Module
假設轉換聲明:
one = "1"
two = "1"
three = "123"
four = "5678"
five = "testing"
FS = character (field separator)
上串接我需要一個固定長度字符串,例如像這樣的字符串:
one & two & FS & three & FS & five & FS & four
輸出:自四是剩餘的4個字符長度8的固定長度字符串應採用空值填充,如下
11 FS 123 FS testing FS 5678XXXX
這不是VB6語句。你從什麼轉換而來,最終的結果是什麼? – Deanna 2012-08-06 11:46:14
你能顯示原始代碼嗎? – 2012-08-06 14:37:35
@MarkBertenshaw:放置一個示例代碼和預期的結果... – Ragav 2012-08-09 18:10:20