Solved

Convert some code from VB.Net to C#.net

Posted on 2011-09-16
5
279 Views
Last Modified: 2012-05-12
Hey guys,

I'm trying to convert a couple of snippets from VB.net to C#.net:
I am trying to create a thread:

            cmdCancelUS.Enabled = True;
            RCSThread = New .Thread(AddressOf requestcardswipe);
            RCSThread.Start();

and

 Private Sub requestcardswipe()
        If chkUseUSB.Checked Then
            UPED.USBDeviceIndex = cboUSBDevices.SelectedIndex
            UPED.UseUSBCardReader = True
        End If

        UPED.EnableManualCardEntry = chkManualCard.Checked
        UPED.SupressManualEntryRollover = chkSupressManualEntryRollover.Checked
        UPED.SwipeTimeout = txtSwipeTimeout.Text
        UPED.RequestCardSwipe()

        RCSThread.Abort()
        cmdCancelUS.Enabled = False
    End Sub

Also what is the deal with 'Invalid Token' with  '=','(',')'?

Any help is appreciated,
Jerry



0
Comment
Question by:JDL129
  • 2
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 100 total points
ID: 36551656
Please try:

cmdCancelUS.Enabled = true;
RCSThread = new Thread(new ThreadStart(this.requestcardswipe));
RCSThread.Start();

Open in new window


private void requestcardswipe()
{
	if (chkUseUSB.Checked)
	{
		UPED.USBDeviceIndex = cboUSBDevices.SelectedIndex;
		UPED.UseUSBCardReader = true;
	}

	UPED.EnableManualCardEntry = chkManualCard.Checked;
	UPED.SupressManualEntryRollover = chkSupressManualEntryRollover.Checked;
	UPED.SwipeTimeout = txtSwipeTimeout.Text;
	UPED.RequestCardSwipe();

	RCSThread.Abort();
	cmdCancelUS.Enabled = false;
}

Open in new window

0
 

Author Comment

by:JDL129
ID: 36551821
wdosanjos!!!!!!!!!!!!!!!

How do I declare RCSThread?

Thanks,
Jerry
0
 
LVL 23

Expert Comment

by:wdosanjos
ID: 36552046
You should define it as:

private Thread RCSThread;
0
 
LVL 11

Assisted Solution

by:brutaldev
brutaldev earned 25 total points
ID: 36552307
Whenever you need to convert from VB.NET to C# in future, use http://www.developerfusion.com/tools/convert/vb-to-csharp/
0
 

Author Closing Comment

by:JDL129
ID: 36570820
Hey guys, so sorry I'm late awarding points but my laptop doesn't work on the
Expert-Exchange short cuts so I opened it in expert mode.

Works now!!

Thanks for all your help!!!!
Jerry
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

911 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

24 Experts available now in Live!

Get 1:1 Help Now