|
Hi,
Please let me know where can i find the diff b/w c# and c++
|
|
|
|
|
|
Have you even attempted to look for any information on your own?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I guess posting on codeproject is easier than searching Google.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
There's plenty of answers to that question online.
|
|
|
|
|
hi , sorry my english is very bad so, can you help me if a write my problem in french
..
"pour simplifier ma question,
je débute en programme c# et le Pb est le suivant :
dans mon application je possède deux formulaires form1 et form2 et supposons que dans le code source de form1 j'ai 'X' une variable qui a pour valeur '6',et aussi dans form1 j'ai un boutton qui me permet de basculer a form2 et dans le code source de cette dernière je voudrai utiliser (ou récupérer)cette valeur c-à-d "6" pour d'autres calcules . voila j'espère avoir été assez claire"
Friends any help is greatly appreciated
|
|
|
|
|
où est la question?
it is yet again a "how do we pass a variable, an object, a whatever from one Form to another?". this gets asked and answered on a daily basis, although it is fundamental and covered in every introductory book.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
I'm afraid my french is non-existent, though I managed to work out your question without difficulty. No chance of replying in French though I am afraid.
in the button click on form1 you can pass the value of x to form2, either as a parameter in the constructor, or by creating a property on Form2 that you set in the button click event.
Pretty basic .Net coding really. When is the homework due in?
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Have you tried "Google Translate"?
I don't understand French
Avez-vous essayé "Google Translate"?
Je ne comprends pas le français
public class Form2 : Form
{
<snip>
public String someText = "OO";
<snip>
}
public class Form1 : Form
{
<snip>
public void ButtionOk_Click(Object, System.EventArgs e)
{
Form2 frm = new Form2()
frm.someText = "NOPE";
frn.show();
}
<snip>
}
|
|
|
|
|
Vous pouvez passer le valeur de X quand vous creez la Form2 (Constructor).
Vous pouvez créer une propriété que s'appelle aussi X en Form2, et la settez avant the utilizez le Show de Form2.
Vous pouvez faire un chose que ça samble a Delphi. Créez un "variable" static en Form1 que s'appele Value. Quand tu créez Form1 vouz settez le valeur (Form1.Value) comme "this" (constructor de Form1)
E en Form2 vous utilizes Form1.Value.X quand vous besoin.
|
|
|
|
|
Hi,
public class Parent
{
string parentString;
public Parent()
{
Console.WriteLine("Parent Constructor.");
}
public void print()
{
Console.WriteLine("I'm a Parent Class.");
}
}
public class Child : Parent
{
public Child()
: base("From Derived")
{
Console.WriteLine("Child Constructor.");
}
public static void Main()
{
Child child = new Child();
child.print();
}
}
In the above example why we should give public in front of each class name...eventhough
after removing that modifier it works in the same way....and when i tried to give private in front of class name it throws error...
Please let me know im a beginner in c#
|
|
|
|
|
Private members, are accessable only in the same class. So if you declare an integer as private, you can only access that integer within the class. Classes however must be available somehow. The private modifier in front of the class would make the class inaccessable. If you want the class to be accessable only from the same project use the internal modifier.
|
|
|
|
|
http://msdn.microsoft.com/en-us/library/ms173121.aspx[^]
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
To make it clear (to the reader not to the compiler) that you want it public. Leaving it out results in the class being public by default anyway, so it doesn't make much difference.
I'm of the opinion that there should be no default access modifiers, that the developer should always specify his intent by including one. (Same with virtual/sealed as well.)
"Things would be different if I ran the zoo." -- Dr. Seuss
|
|
|
|
|
Sorry but the default is internal!
From MSDN:
Classes and structs that are declared directly within a namespace (in other words, they are not nested within other classes or structs) can be either public or internal. Internal is the default if no access modifier is specified.
Greetings
Covean
|
|
|
|
|
I sit corrected; but that's simply more reason not to have a default.
|
|
|
|
|
There you are completely right. I also always use access modifier. At least this looks better in code.
Greetings
Covean
|
|
|
|
|
If you remove the public in front of your class def it becomes internal.
internal:
The type or member can be accessed by any code in the same assembly, but not from another assembly.
Greetings
Covean
|
|
|
|
|
You use Public because it helps in code reusability and extensibility. If ur class is private it becomes inaccessible same for any private members or methods. they can only be used by the objects of that class. U might want to extend it's functionality in future by inheriting. Hence it's a good practise to make your class public.
|
|
|
|
|
|
Only grant as much access as required. For many classes and structs that will be public, but a developer still needs to consider each case carefully.
|
|
|
|
|
HELLO,
MY STRING IS DD/MON/YYYY.I WANT TO SPLIT THIS STRING INTO INDIVIDUAL PART LIKE DD,MMM,AND YYYY.AND FINALY BIND THESE INDIVIDUAL VALUE INTO 3 COMBOBOXEX LIKE DAY,MONTH AND YEAR.I HAVE DONE THE CODE BUT ITS WORKING FOR SOME VALUE AND NOT WORKING FOR OTHER.
MY CODE: string s = rows[6].ToString();//DOB LIKE 15/JULY/1988
int i = s.IndexOf("/");
t = s.Substring(0, i);
t1 = s.Substring(0);
t2 = s.Substring(i + 1, i + 2);
int i1 = s.IndexOf("/");
t3 = s.Substring(i1 + 5);
comboBox2.Text = t.ToString();15
comboBox3.Text = t2.ToString();JULY
comboBox4.Text = t3.ToString();1988
|
|
|
|
|
Have a look at DateTime::Parse and DateTime::ParseExact this should solve your problem.
[edit] I don't know why but thanks to this member who rated 1 for this. I think
its really the better solution to parse a date time at your own or splitting the string.
[/edit]
Greetings
Covean
modified on Friday, November 13, 2009 7:48 AM
|
|
|
|
|
a little edit
DateTime.Parse and DateTime.ParseExact
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Yes are right but I think he know what he should do now. ^^
Greetings
Covean
|
|
|
|