473,322 Members | 1,755 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,322 software developers and data experts.

C# Conversion

Having a small problem figuring out how to convert the following structures
to VB:

[StructLayout(LayoutKind.Sequential, Pack = 4)]
private struct RECT
{
public int left;
public int top;
public int right;
public int bottom;

public override string ToString()
{
string ret = String.Format(
"left = {0}, top = {1}, right = {2}, bottom = {3}",
left, top, right, bottom);
return ret;
}
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
private struct PAINTSTRUCT
{
public IntPtr hdc;
public int fErase;
public RECT rcPaint;
public int fRestore;
public int fIncUpdate;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=32)] public byte[]
rgbReserved;

public override string ToString()
{
string ret = String.Format(
"hdc = {0} , fErase = {1}, rcPaint = {2}, fRestore = {3}, fIncUpdate =
{4}",
hdc, fErase, rcPaint.ToString(), fRestore, fIncUpdate);
return ret;
}
}

Thanks,
Sueffel
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/2004
Nov 20 '05 #1
2 2494
http://www.kamalpatel.net/ConvertCSharp2VB.aspx

<StructLayout(LayoutKind.Sequential, Pack = 4)> _
Private Structure RECT
Public left As Integer
Public top As Integer
Public right As Integer
Public bottom As Integer

Public Overrides Function ToString() As String
String ret = String.Format(
"left = {0}, top = {1}, right = {2}, bottom = {3}",
left, top, right, bottom)
Return ret
End Function
End Structure

<StructLayout(LayoutKind.Sequential, Pack = 4)> _
Private Structure PAINTSTRUCT
Public hdc As IntPtr
Public fErase As Integer
Public rcPaint As RECT
Public fRestore As Integer
Public fIncUpdate As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst=32)> _ Public Byte()
rgbReserved
Public Overrides Function ToString() As String
String ret = String.Format("hdc = {0}, fErase = {1}, rcPaint = {2},
fRestore = {3}, fIncUpdate ={4}",hdc, fErase, rcPaInteger.ToString(),
fRestore, fIncUpdate)
Return ret
End Function
End Structure

'----------------------------------------------------------------
' Converted from C# to VB .NET using CSharpToVBConverter(1.2).
' Developed by: Kamal Patel (http://www.KamalPatel.net)
'----------------------------------------------------------------

"Sueffel" <so*****@somewhere.com> wrote in message
news:uk**************@TK2MSFTNGP11.phx.gbl...
Having a small problem figuring out how to convert the following structures to VB:

[StructLayout(LayoutKind.Sequential, Pack = 4)]
private struct RECT
{
public int left;
public int top;
public int right;
public int bottom;

public override string ToString()
{
string ret = String.Format(
"left = {0}, top = {1}, right = {2}, bottom = {3}",
left, top, right, bottom);
return ret;
}
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
private struct PAINTSTRUCT
{
public IntPtr hdc;
public int fErase;
public RECT rcPaint;
public int fRestore;
public int fIncUpdate;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=32)] public byte[]
rgbReserved;

public override string ToString()
{
string ret = String.Format(
"hdc = {0} , fErase = {1}, rcPaint = {2}, fRestore = {3}, fIncUpdate = {4}",
hdc, fErase, rcPaint.ToString(), fRestore, fIncUpdate);
return ret;
}
}

Thanks,
Sueffel
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/2004

Nov 20 '05 #2
"Nick" <ne**@zigamorph.com> wrote in message
news:OZ****************@TK2MSFTNGP12.phx.gbl...
http://www.kamalpatel.net/ConvertCSharp2VB.aspx

<StructLayout(LayoutKind.Sequential, Pack = 4)> _
Private Structure RECT
Public left As Integer
Public top As Integer
Public right As Integer
Public bottom As Integer

Public Overrides Function ToString() As String
String ret = String.Format(
"left = {0}, top = {1}, right = {2}, bottom = {3}",
left, top, right, bottom)
Return ret
End Function
End Structure

<StructLayout(LayoutKind.Sequential, Pack = 4)> _
Private Structure PAINTSTRUCT
Public hdc As IntPtr
Public fErase As Integer
Public rcPaint As RECT
Public fRestore As Integer
Public fIncUpdate As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst=32)> _ Public Byte()
rgbReserved
Public Overrides Function ToString() As String
String ret = String.Format("hdc = {0}, fErase = {1}, rcPaint = {2},
fRestore = {3}, fIncUpdate ={4}",hdc, fErase, rcPaInteger.ToString(),
fRestore, fIncUpdate)
Return ret
End Function
End Structure

'----------------------------------------------------------------
' Converted from C# to VB .NET using CSharpToVBConverter(1.2).
' Developed by: Kamal Patel (http://www.KamalPatel.net)
'----------------------------------------------------------------

"Sueffel" <so*****@somewhere.com> wrote in message
news:uk**************@TK2MSFTNGP11.phx.gbl...
Having a small problem figuring out how to convert the following structures
to VB:

[StructLayout(LayoutKind.Sequential, Pack = 4)]
private struct RECT
{
public int left;
public int top;
public int right;
public int bottom;

public override string ToString()
{
string ret = String.Format(
"left = {0}, top = {1}, right = {2}, bottom = {3}",
left, top, right, bottom);
return ret;
}
}

[StructLayout(LayoutKind.Sequential, Pack = 4)]
private struct PAINTSTRUCT
{
public IntPtr hdc;
public int fErase;
public RECT rcPaint;
public int fRestore;
public int fIncUpdate;
[MarshalAs(UnmanagedType.ByValArray, SizeConst=32)] public byte[]
rgbReserved;

public override string ToString()
{
string ret = String.Format(
"hdc = {0} , fErase = {1}, rcPaint = {2}, fRestore = {3},

fIncUpdate =
{4}",
hdc, fErase, rcPaint.ToString(), fRestore, fIncUpdate);
return ret;
}
}

Thanks,
Sueffel
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/2004



Thank you, the site helps alot!
Still having some issues, but it is just some minor differences between the
two languages. In case your wondering, I'm converting the Painting the MDI
Client Area example from VBAccelerator.com from C# to VB.NET. Soo much
fuin...

Thanks Again,
Sueffel
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.558 / Virus Database: 350 - Release Date: 1/2/2004
Nov 20 '05 #3

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

Similar topics

1
by: Stub | last post by:
Docs says that "The compiler does not use an explicit constructor to implement an implied conversion of types. It's purpose is reserved explicitly for construction." I put up code of three cases...
7
by: Michael Lehn | last post by:
Hi, I have a question regarding the conversion of objects. When is the conversion done by the constructor and when by the operator. My feeling tells me that the constructor is preferred. But...
16
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. ...
31
by: Bjørn Augestad | last post by:
Below is a program which converts a double to an integer in two different ways, giving me two different values for the int. The basic expression is 1.0 / (1.0 * 365.0) which should be 365, but one...
11
by: Steve Gough | last post by:
Could anyone please help me to understand what is happening here? The commented line produces an error, which is what I expected given that there is no conversion defined from type double to type...
2
by: Alex Sedow | last post by:
Why explicit conversion from SomeType* to IntPtr is not ambiguous (according to standart)? Example: // System.IntPtr class IntPtr { public static explicit System.IntPtr (int); public...
3
by: Steve Richter | last post by:
here is a warning I am getting in a C++ .NET compile: c:\SrNet\jury\JuryTest.cpp(55) : warning C4927: illegal conversion; more than one user-defined conversion has been implicitly applied while...
0
by: Lou Evart | last post by:
DOCUMENT CONVERSION SERVICES Softline International (SII) operates one of the industry's largest document and data conversion service bureaus. In the past year, SII converted over a million...
0
by: dataentryoffshore | last post by:
Get a Discount up to 60% on data entry, data capture, dataentry services, large volume data processing and data conversion services through offshore facilities in India. Offshore data entry also...
21
by: REH | last post by:
It it permissible to use the constructor style cast with primitives such as "unsigned long"? One of my compilers accepts this syntax, the other does not. The failing one chokes on the fact that the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.