VB.NET code to C#

I have a vb code. i want to change it in C#.

Page 1 of 1

2 Replies - 633 Views - Last Post: 29 April 2010 - 05:22 PM Rate Topic: -----

#1 jangir90  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 15-September 09

VB.NET code to C#

Posted 29 April 2010 - 01:13 PM

hiiiii
I have a vb code . i want to change this code in C# but i have occuring some problem while converting it.
will you please help me.
the vb code is as follows
public declare function systemparameterinfo lib "user32" alias "systemparameterinfo1"( BYval uaction as integer, ByVal uparams as integer, ByVal ipvparams as string, ByVal fuwinini as integer) as integer


Please help me and tell what will be its equivalent code.

This post has been edited by PsychoCoder: 29 April 2010 - 05:23 PM
Reason for edit:: Title edited to be more descriptive


Is This A Good Question/Topic? 0
  • +

Replies To: VB.NET code to C#

#2 W3bDev  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 42
  • View blog
  • Posts: 379
  • Joined: 15-March 09

Re: VB.NET code to C#

Posted 29 April 2010 - 01:35 PM

Not too difficult, just figure out what it needs to return, and write a integer method, ie...

public int systemParameterInfo(int uaction, int uparams, string fuwinini)
        {
            int calculateInt = 0; // insert logic
            return calculateInt;
        }

Was This Post Helpful? 0
  • +
  • -

#3 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1639
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: VB.NET code to C#

Posted 29 April 2010 - 05:22 PM

Here's what it would look like. What you have is a Win32 function declaration and would look like this in C#

[DllImport("user32", EntryPoint = "systemparameterinfo1", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
public static extern int systemparameterinfo(int uaction, int uparams, string ipvparams, int fuwinini);


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1