Solved

Need to convert a snippet from VB to C#

Posted on 2011-09-09
5
237 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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