?
Solved

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

Posted on 2011-09-16
5
Medium Priority
?
285 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 400 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 100 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

764 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