Solved

Need to convert a snippet from VB to C#

Posted on 2011-09-09
5
234 Views
Last Modified: 2013-12-17
Hey Guys!!

I need to convert the following code to C#.net.

With charge1

  .LoggingLevel = 3
  .MaxLogSize = 3
 
   .Device = DeviceType_ppdVerifone_Mx870
    .ComPort = "COM5"
    .Baud = "115200"
    .DataBits = "8"
    .Parity = "N"
'    .MxCommSetting = MxCommType_IP
'    .MxPort = "9001"
'    .MxIPAddress = "10.64.106.119"

    .InitalizePinPad
       
    If .InitalizePinPad = True Then
   
       MsgBox "initialized"
          .ChangeForm ("WELCOME")
    Else
        MsgBox "Not initialized"
    End If
End With


Thanks a bunch!!

Jerry
0
Comment
Question by:JDL129
  • 3
  • 2
5 Comments
 
LVL 1

Expert Comment

by:Temizh
ID: 36514076
With ... End With Block helps you by calling the object only with a dot. so here is your C# code:

   charge1.LoggingLevel = 3;
   charge1.MaxLogSize = 3;

   charge1.Device = DeviceType_ppdVerifone_Mx870;
   charge1.ComPort = "COM5";
   charge1.Baud = "115200";
   charge1.DataBits = "8";
   charge1.Parity = "N";
   charge1.InitalizePinPad // not sure here. if it is a function than use charge1.InitalizePinPad

if(charge1.InitalizePinPad == true)
{
      MsgBox.Show("initialized");
      charge1.ChangeForm("WELCOME");
}
else
{
      MsgBox.Show("Now initialized);
}
0
 

Author Comment

by:JDL129
ID: 36514965
Temizh:!!!!!!
Thanks for the response!!!!!

All of the ='s have red squigly's under them with error messages that indicate: Invalid Token '=' in class, struct or interface member declaration.

Perhaps I should have indicated the following: Dim WithEvents charge1 As SIM.Charge that needs to be converted as well.

Sorry,
Jerry
0
 
LVL 1

Accepted Solution

by:
Temizh earned 125 total points
ID: 36515490
You shall give me all codes. And before this code you shoud have this:

var charge1 = new charge1(); or var vharge1 = value;
0
 

Author Closing Comment

by:JDL129
ID: 36526185
Thanks for the response!!!

Jerry
0
 
LVL 1

Expert Comment

by:Temizh
ID: 36527471
You're welcome.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now