SAMERH

Hi,
I'm kind of new on VC++ 2005. So I have some questions. I've used to write these codes to execute actions.

Actions and Codes to execute them:
--------------------------------------------
Dim str as String = TextBox1.Text
TextBox2.Text = Mid(str, 5, 1)
To return a string containing a specified number of characters from a string
Dim str as String = "A"
TextBox1.Text = Asc(str)
To return an Integer value representing the character code corresponding to a character.
PictureBox1.Image = Image.FromFile( _
"C:\MyImage.jpg")
To load an image and display it on a picturebox control in the form.
Can anybody please tell me how I can perform these actions using Visual C++ 2005
Thanks



Re: Visual C++ General questions on vc++

Pintu Shukla

This is a Vb (Visual Basic) Code not VC++(Visual C++) . So this is not a right place to ask this question

Thanx





Re: Visual C++ General questions on vc++

Andreas Masur

Pintu Shukla wrote:
This is a Vb (Visual Basic) Code not VC++(Visual C++) . So this is not a right place to ask this question


SAMERH wrote:
Can anybody please tell me how I can perform these actions using Visual C++ 2005









Re: Visual C++ General questions on vc++

Andreas Masur

SAMERH wrote:
Dim str as String = TextBox1.Text
TextBox2.Text = Mid(str, 5, 1)
To return a string containing a specified number of characters from a string


The part with getting the string from the text field certainly depends on the framework you are using (Win32 API, MFC etc.) and tis also affects the string type you would use. For example, using MFC und 'CString' you actually can use the same function 'Mid()'.

SAMERH wrote:

Dim str as String = "A"
TextBox1.Text = Asc(str)
To return an Integer value representing the character code corresponding to a character.


Well...can be as easy as

char c = 'A';
int i = static_cast<int>(c);
SAMERH wrote:
PictureBox1.Image = Image.FromFile( _
"C:\MyImage.jpg")
To load an image and display it on a picturebox control in the form.


Also depends on the framework you are using...take a look at the following for example...






Re: Visual C++ General questions on vc++

Pintu Shukla

My fault I am sorry .Anyway here is the answer

SAMERH wrote:

Actions and Codes to execute them:
--------------------------------------------
Dim str as String = TextBox1.Text
TextBox2.Text = Mid(str, 5, 1)
To return a string containing a specified number of characters from a string


in the Above case you Can use CString and it's member Function Mid()
SAMERH wrote:
Dim str as String = "A"
TextBox1.Text = Asc(str)
To return an Integer value representing the character code corresponding to a character.

this you can do by Following method without any cast

Code Block

char ch = 'A';
int iVal = ch;
cout<<iVal; //Will Print 65 here




SAMERH wrote:
PictureBox1.Image = Image.FromFile( _
"C:\MyImage.jpg")
To load an image and display it on a picturebox control in the form.


it's Depend what you can do you Simply can use Picture Control in this case and can upload your Image to Picture Control .

Thanx