Solved

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

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Suggested Courses

739 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