473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

equivilant declaration in vb .net? (from vb6 sample)

public cFileName As String * MAX_PATH
public cAlternate As String * 14
--
Scott Emick
Web Programmer
Fox International
Remove the ham from mail address if it's not spam
Nov 20 '05 #1
4 1722
I think this is it: (added this)

<VBFixedString(MAX_PATH),System.Runtime.InteropSer vices.MarshalAs(System.Runtime.InteropServices.Unm anagedType.ByValTStr,SizeConst:=MAX_PATH)>
Public cFileName As String

<VBFixedString(14),System.Runtime.InteropServices. MarshalAs(System.Runtime.InteropServices.Unmanaged Type.ByValTStr,SizeConst:=14)>
Public cAlternate As String
"news.microsoft.com" <se****@ham.fox-international.com> wrote in message
news:e6**************@tk2msftngp13.phx.gbl...
public cFileName As String * MAX_PATH
public cAlternate As String * 14
--
Scott Emick
Web Programmer
Fox International
Remove the ham from mail address if it's not spam

Nov 20 '05 #2

"Scott Emick" <se****@ham.fox-international.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I think this is it: (added this)

<VBFixedString(MAX_PATH),System.Runtime.InteropSer vices.MarshalAs(System.Run
time.InteropServices.UnmanagedType.ByValTStr,SizeC onst:=MAX_PATH)> Public cFileName As String

<VBFixedString(14),System.Runtime.InteropServices. MarshalAs(System.Runtime.I
nteropServices.UnmanagedType.ByValTStr,SizeConst:= 14)> Public cAlternate As String


Is this recommended practice or are you better off handling/enforcing
fixed-width strings through code? It seems to me like this is just a
backwards-compatibility thing.
Nov 20 '05 #3
* "news.microsoft.com" <se****@ham.fox-international.com> scripsit:
public cFileName As String * MAX_PATH
public cAlternate As String * 14


Have a look at the docs for the 'VBFixedStringAttribute' class.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
I wouldn't normally use fixed-length strings, but I was calling a
win32 api and it required that (in the vb6 code), so I was carrying it
over to .net.

Scott

"Jeff Johnson [MVP: VB]" <i.***@enough.spam> wrote in message news:<#a**************@TK2MSFTNGP09.phx.gbl>...
"Scott Emick" <se****@ham.fox-international.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I think this is it: (added this)

<VBFixedString(MAX_PATH),System.Runtime.InteropSer vices.MarshalAs(System.Run
time.InteropServices.UnmanagedType.ByValTStr,SizeC onst:=MAX_PATH)>
Public cFileName As String

<VBFixedString(14),System.Runtime.InteropServices. MarshalAs(System.Runtime.I
nteropServices.UnmanagedType.ByValTStr,SizeConst:= 14)>
Public cAlternate As String


Is this recommended practice or are you better off handling/enforcing
fixed-width strings through code? It seems to me like this is just a
backwards-compatibility thing.

Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

83
by: Alexander Zatvornitskiy | last post by:
Hello All! I'am novice in python, and I find one very bad thing (from my point of view) in language. There is no keyword or syntax to declare variable, like 'var' in Pascal, or special syntax in...
2
by: blueblueblue2005 | last post by:
Hi, there was a post several days ago about using forward class declaration to solve the circular including issue, today, one question suddenly came into mind: which class should the forward class...
4
by: Jeff | last post by:
Hello all, I've created a COM dll for a number-crunching program. However when I tell the program what function to use from the DLL, it claims that it cant find the function. I have the...
63
by: Nick Palmer | last post by:
Hi all, Is there a DB2 equivilant to Oracle's DB Link functionality ? I have two DB2 databases and I need to get access to the tables in one from the other. In Oracle I would just create a DB...
6
by: Trint Smith | last post by:
This is how I did this sql server 2000 string in vb.net: "FROM TBL_TravelMain WHERE TravelMain_Mlv = '" & MLVTrimString & "'" In C# you can't use the & something &. How do I put this in C#,...
15
by: Simon Harris | last post by:
Hi All, I am looking for the asp.net equiv' to ASP include files. Something which will build common, much used parts of a page, such as header, footer etc... We have 3-4 developers, so...
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
28
by: Larax | last post by:
Best explanation of my question will be an example, look below at this simple function: function SetEventHandler(element) { // some operations on element element.onclick = function(event) {
6
by: WT | last post by:
Hello, Using url rewritting and ajax.net, I tried to circumvent some potential problems with postback url using a code from a sample given by Scott. The idea is to use a control Adapter on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.