Solved

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

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

708 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

15 Experts available now in Live!

Get 1:1 Help Now