473,498 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

convert

82 New Member
Hio
I have this code which was written in VB and works in VB, but I have started to convert it to c#. But now I'm stuck. Can somebody help me to finish the conversion please. This is as far as I could get.

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Threading;
  10. using System.IO;
  11.  
  12. namespace Vision 
  13. {
  14.     public partial class Form1 : Form 
  15.     {
  16.         public Form1() 
  17.         {
  18.         InitializeComponent();
  19.         }
  20.  
  21.         private void Form1_Load(object sender, EventArgs e) 
  22.         {
  23.         picOutputLeft.SizeMode = PictureBoxSizeMode.StretchImage;
  24.         picOutputRight.SizeMode = PictureBoxSizeMode.StretchImage;
  25.         myCamLeft = new ICam();
  26.         myCamRight = new ICam;
  27.         myCamLeft.initCam(picOutputLeft.Handle.ToInt32);
  28.         myCamRight.initCam(picOutputRight.Handle.ToInt32);
  29.         }
  30.  
  31.         public myCamLeft as ICam;
  32.         public myCamRight as ICam;
  33.  
  34.  
  35.         private void btnViewLeftStill_Click(object sender, EventArgs e)
  36.         {
  37.         if (myCamLeft.iRunning = true)
  38.           {
  39.             FrmImage FrmImage = new FrmImage();
  40.             FrmImage.picImage.Image = myCamLeft.copyFrame(picOutputLeft, new RectangleF(0, 0, picOutputLeft.Width, picOutputLeft.Height));
  41.             FrmImage.Show();
  42.           }
  43.         else
  44.           {
  45.             MessageBox.Show("Left Camera Is Not Running!");
  46.           }
  47.         }
  48.  
  49.         public void btnViewRightStill_Click(object sender, EventArgs e)
  50.         {
  51.         if (myCamRight.iRunning = true)
  52.           {
  53.             FrmImage FrmImage = new FrmImage();
  54.             FrmImage.picImage.Image = myCamRight.copyFrame(picOutputRight, new RectangleF(40, 0, picOutputRight.Width, picOutputRight.Height));
  55.             FrmImage.Show();
  56.           }
  57.         else
  58.           {
  59.             MessageBox.Show("Right Camera Is Not Running!");
  60.           }
  61.        }
  62.    }
  63. }
Ta
Oct 8 '09 #1
3 1291
ssnaik84
149 New Member
try this online converter

Also, check this article.. it's very good comparison..
Oct 8 '09 #2
tlhintoq
3,525 Recognized Expert Specialist
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.
Oct 8 '09 #3
GaryTexmo
1,501 Recognized Expert Top Contributor
Additionally, when you post, can you please describe your problem in a bit more detail? What exactly is wrong with the code, how is it not working, is it throwing exceptions, is it giving unexpected results, and what are those results?

That said, I can spot a problem right away, and definitely a common mistake when going from VB code to C/C++/C# style code (I catch myself on this constantly, so don't feel bad).

Your comparison operators are incorrect. You're actually using an assignment operator. In C/C++/C#, the equivalence comparison operator is == and the assignment operator is =. In VB, they are both =.

So your if statements should be changed from...

Expand|Select|Wrap|Line Numbers
  1. if (something = value)...
... to ...

Expand|Select|Wrap|Line Numbers
  1. if (something == value)...
In your code (lines 37 and 51, specifically), you're assigning values to myCamLeft.iRunning and myCamRight.iRunning, instead of checking their values.
Oct 8 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

19
7245
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below....
1
1787
by: Logan X via .NET 247 | last post by:
It's official....Convert blows. I ran a number of tests converting a double to an integer usingboth Convert & CType. I *ASSUMED* that CType would piggy-back ontop of Convert, and that performance...
4
3598
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is...
7
7070
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done...
3
10237
by: Convert TextBox.Text to Int32 Problem | last post by:
Need a little help here. I saw some related posts, so here goes... I have some textboxes which are designed for the user to enter a integer value. In "old school C" we just used the atoi function...
7
29149
by: patang | last post by:
I want to convert amount to words. Is there any funciton available? Example: $230.30 Two Hundred Thirty Dollars and 30/100
4
4501
by: Edwin Knoppert | last post by:
In my code i use the text from a textbox and convert it to a double value. I was using Convert.ToDouble() but i'm used to convert comma to dot. This way i can assure the text is correct. However...
1
3566
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
6
4239
by: Ken Fine | last post by:
This is a basic question. What is the difference between casting and using the Convert.ToXXX methods, from the standpoint of the compiler, in terms of performance, and in other ways? e.g. ...
0
10705
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
6993
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7197
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7375
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4899
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4584
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.