By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,344 Members | 1,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,344 IT Pros & Developers. It's quick & easy.

C# Conversion

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.