Solved

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

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# HTTP GET method sample code 3 57
Help with C#, MVC, razor. 6 34
Coding C# in Linux 8 61
Finally almost got it 5 36
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

785 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