我只是想转换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