i setup a simple loop and wanted a window to appear showing the results of the loop .. it fails, but works perfeclty fine in VB!
private void button1_Click(object sender, EventArgs e)
{
int count = 10;
while (count > 5)
{
count = count - 1;
MessageBox.Show(count);
}
made small amendment. says it cant convert from int to string
however it will work with string, like this:
private void button1_Click(object sender, EventArgs e)
{
string count = "john";
{
MessageBox.Show(count);
}
so somethings telling me VB has one over C# on that simple action. so i gota figure a way out of formatting that integer value to a string i guess in order to show it in the textbox but even the ToString method fails to work .. hmmmmm
Loading
theLizardPosted Dec 14, 2010, 6:33 PM
Semantics,
Unicode is a string type which is, well Unicode compliant
ANSI is a string type.
You know what nvarchar is In SQL Server don't you? If not it is the Unicode equivalent of varchar, you do know that don't you.
Sam HobbsPosted Dec 14, 2010, 5:49 PM
In spite of everything theLizard posted, there is nothing saying that the C++ language has a Unicode or Ansi type. There are types such as char and std:string for ANSI strings and wchar_t and std:wstring for Unicode strings, but not a type called Unicode or Ansi.
theLizardPosted Dec 14, 2010, 4:16 PM
I taught myself as well so I know where you are coming from, the only way to know which will be your preferred language is by doing what you are doing keep going and don't let others force you into one direction or another.
Sam, you are as predictable as night follows day. Sam, do you know what www means! if you are not sure, it is world wide web, you know the means by which this forum gets around. Instead of making silly remarks like
"The Unicode and Ansi types are probably extensions to the C++ compiler that theLizard uses"
Why don't you do a google search and see what comes up, try this link http://en.wikipedia.org/wiki/Unicode or this one http://www.joelonsoftware.com/articles/Unicode.html and this one http://support.microsoft.com/kb/239530 and last but not the least http://unicode.org/standard/WhatIsUnicode.html oops, this last one is from the Unicode Consortium.
Look here as well http://code.msdn.microsoft.com/UnicodeTDecorator which says
Resource Page Description
A macro for Visual Studio, that decorates strings in C/C++ source code, to make them Unicode-aware, using _T() or TEXT() decoration. ...
I got 169,000 hits on a search for UnicodeString in google 50,500 for "UnicodeString c++"
The Complete Guide to C++ Strings, Part I - Win32 Character Encodings
Sam, you do really need to know what you are talking about before commenting, it makes you look silly.
Suthish NairPosted Dec 14, 2010, 4:49 AM
Why I said that i liked Sam reply because John even not interested in finding out why vb.net not asking for a .ToString() conversion. Even the sample he using having MessageBox.Show which accepts only a string text as message, an internal conversion happening in vb.net?. Then how come vb.net not throwing error.
But, he started rating both languages. He needs to learn more, instead of complainig.
So what we could expect an reply from a forum member. Its users choice which one to use.
There are lots of disscussion happenig about vb.net vs c#. Jhon refer link.
So dont complain each other, every one here to learn only.
John BurnsPosted Dec 14, 2010, 4:04 AM
John
Sam HobbsPosted Dec 14, 2010, 3:44 AM
The problem is that theLizard won't admit mistakes. He won't admit the mistake, but there is no type Unicode or type Ansi in the C++ language. There is the std::string type and the std::wstring type but not Unicode or Ansi. The C++ language won't convert a std::string instance to a std::wstring instance, not even using explicit casts, without explicitly calling a conversion function. The Unicode and Ansi types are probably extensions to the C++ compiler that theLizard uses (not Microsoft C++) or some other library but not the C or C++ standard libraries.
Sure, people are entitled to an opinion but the owners of this web site have the right to deny it's use to people that make unproductive comments. That has not happened here but I am saying that people do not have the unconditional right to say whatever they want to say in this web site.
theLizard will likely reply and please don't misinterpret that as anything except it is unlikely there is any benefit in replying.
John BurnsPosted Dec 14, 2010, 2:45 AM
Sam,
Firstly you gota understand; i came from a bad background and have taught myself everything i know ... everything, no tutor and no support so i think i done pretty damn well up till now. and yes actually , i do like to do the opposite of what people tell me, that is how i get my ideas and thats how big things start, i never followed "the trend" i never will on most things, i am unique and have my own way of doing things; i have an idea one day for a program that has has never been created and never done and hope that it will sell and make me a lot of money but i need the skill to code it up.
And you say "go ahead, choose vb" ... well i might just, as i say im here to learn and experement with things, im not "held down" just as its a C# forum, were all programmers and its MSIL that does the talking and not c# or vb, so let me make my own mind up, we are all entitled to our own opinions and ive spent so much money and time getting this far i just wana dip my feet in the water as it were, still testing stuff out.
AS FOR THE WHOLE "c# = 1 vb = 0" it was intended to be funny; but all in all i appreciate you comment, as i said were all entitled to our own opinion.
i have posted stuff on other forums before and go no reply sometimes, and with most folk they would throw a strop and give up but i posted here not knowing how it worked, so i went back over it again anad again trying myself to figure it out, and i done it, simple as it was but im new to C# i have the drive to try and solve things out and that is what will make me a good coder one day, hold me to that.
Suthish,
i know you like Sams comment, but admit it; you like mine better
The Lizard,
Hell yeh, :p you see where im coming from, i just want to test things out and experement as im still learning and cautious, its almost like im trying to weigh them up before making my real choice on what i want to do; and without any support or tutor you guys provide wee bit of support. Will certainally take that comment on board tho fella :) and thanks for the reply
John
theLizardPosted Dec 14, 2010, 2:32 AM
Ignore Sam, he's probably had one too many again, he likes posting "answers" which are not answers just because he likes to look like an x-spurt in every topic you can imagine.
Most languages have their little idiosyncrasy's VB is good for some jobs and c# is good at others I prefer C++ by Emarcadero because it is as easy as VB but has the power of C++ which in MY opinion is better than C# but I do use C# for my web sites.
In c++ if you declare a variable of type string, Unicode or Ansi you do not need to do things like string.ToString(), it actually sounds silly don't you agree!
My suggestion is to get a copy of C++ builder, if you are a student then you would qualify for the academic version which is very inexpensive and relatively easy to use and it wont throw errors if you declare vars without assigning a value before using like c# does.
Suthish NairPosted Dec 13, 2010, 11:19 PM
Sam HobbsPosted Dec 13, 2010, 10:46 PM
John BurnsPosted Dec 13, 2010, 2:39 PM
C# = 0
John BurnsPosted Dec 13, 2010, 2:39 PM