Solved

Need to convert a snippet from VB to C#

Posted on 2011-09-09
5
231 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for the response!!!

Jerry
0
 
LVL 1

Expert Comment

by:Temizh
Comment Utility
You're welcome.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

12 Experts available now in Live!

Get 1:1 Help Now