|
hi
first one will not assign memory
Second one will
*** Why EXPERTS behave like a fool ***
|
|
|
|
|
I told him this the other day, he did not reply, and just asked again.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Dot_NET Dude wrote: first one will not assign memory
Second one will
I have a question on this, if you answer ?
When we create like
a) Employee emp;
here we cant use all methods or properties of employee class.
but when we create like
b) Employee emp = new Employee();
then, can use all methods & properties.
I had found this behaviour.
So, my question is if we cant use all methods by creating
Employee emp;
then what is the use of it?
|
|
|
|
|
The core answer here is that you have significant gaps in your most basic, elementary knowledge and need to be reading a basic book, so that you can establish some fundamentals. Please do that.
As I answered satish before, although sadly he never responds, he just fails to understand and yet decides to ask again ( which means he will never learn ), Employee emp does not create an employee at all. It creates the space to hold an employee. It's really a shorthand for Employee emp = null; What use is it ? Well, one obvious thing is that one may do this in code:
private Employee _employee = null;
public Employee CurrentEmployee
{
get
{
if (_employee == null)
{
employee = LoadEmployee();
}
return _employee;
}
}
This is called lazy initialisation. This means the program doesn't pay the cost of creating this employee, until it needs it, but then it only pays the price once.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
So the point is to hold until you are not force to create the object.
well thanks a lot for replying sir.
One thing i want to share while reading the books, i just go thru it and get/mug up what is immediate required.
It comes to concern only when i really trying to dry run the code.
Means the application is finished and working, now lets see how i had done this.
|
|
|
|
|
Hi all,
Is there any way to get current weeks detail frm the database using SQL 2000??
For e.g. today is wednesday, i want all data from monday to sunday.
Plz can anyone help in this
--Here 2 See Sharp--
I have not failed. I've just found 10,000 ways that won't work.
|
|
|
|
|
Haven't tried it, but I pasted this from a google search:
SELECT * FROM YourTable
WHERE DATEPART(WK, YourDateColumn) = DATEPART(WK, GETDATE())
Don't know if you can adjust what the starting/ending days are or not. Might ask in the SQL forum.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
thanks a lot steve...
this piece of code has made my things so simple....
it works like a charm....
--Naina
--Here 2 See Sharp--
I have not failed. I've just found 10,000 ways that won't work.
|
|
|
|
|
Hi ,
how can we print a windows form in C# using print document control .....,
im not getting how to assign printdocument1.document= form();
thanks .
|
|
|
|
|
Hello,
You may take a snapshot of Form using PrintToBitmap function of Form.
Following is a code snippet to do so-
---------------
bmp = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height);
this.DrawToBitmap(bmp, new Rectangle(this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width, this.ClientRectangle.Height));
this.PictureBox2.Image = bmp;
---------------
If you want to print this data then you will need to add one PrintDocument object, like this-
Dim WithEvents pdoc As New System.Drawing.Printing.PrintDocument
Add code in PrintPage Event of PrintDocument object –
e.Graphics.DrawImage(bmp, this.ClientRectangle.X, this.ClientRectangle.Y);
Then you may get it printed by simply using a line of code-
pdoc.Print();
This would print the picture of the form.
I hope this helps.
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
HI ,
Thanks for u r reply , what im trying is , ihave a form containg textboxes and labels , i want to print that form as it is .
can you tell me how can i do this .............
|
|
|
|
|
I have already informed you, take image of form in a bitmap object usign DrawToBitmap function, and print this form using PrintDocument control.
If you want to print only some of the controls, use DrawToBitmap function of those controls to draw them in different bitmap objects, because every control comes with this method.
-Dave.
Dave Traister,
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
OK , Thank you i will try
|
|
|
|
|
|
Hi all,
How to convert hex value to extended ascii code and the output should be show in richtextbox.Pls help me.Thank you 2 all..
|
|
|
|
|
Hi,
int.ToString("X8"); is what I use normally.
Not sure why you mention extended ASCII, it's only digits and letters after all.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Well, you pretty much want hex -> int -> ascii right?
Well, you can use Convert.ToInt32, like this:
string hex = "0x0F";
int num = 0;
num = Convert.ToInt32(hex, 16);
The first parameter is the string containing the number, and the second is the base. ie Hex is base 16 and normal int's are base 10. Binary is base 2.
So, now that you have a number cast it as a char, that should give you your ascii character. If you want to build a string, then set up an array of bytes, and fill it with the results from your Convert.ToInt32; you can then get a string from the array by using Encoding.ASCII.GetString(arrayOfBytes);
And, of course, these could have been easily found out by typing something like "c# hex to ascii" or "c# hex to int" something like that.
EDIT: Oh, and you can figure out how to get it into the rich text box yourself right? Good.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
Or do you mean you have the value of a Unicode character in a string as hexadecimal and want to display the character?
|
|
|
|
|
No.Actually i want display ascii character in richtextbox.As a example,in richtextbox i wanna draw rectangle using this ascii char.So i need convert hexadecimal num to ascii char..
|
|
|
|
|
Oh, the line drawing characters? OK, I just tried it and found that Ariel won't do it, but I changed my RichTextBox to use Courier New and it works. So it's a matter of the typeface in use.
|
|
|
|
|
This is what you are asking for:
string hex = "B8";<br />
int code = Convert.ToInt32(hex, 16);<br />
SomeRichTextBox.Text = Encoding.Default.GetString(new byte[] { (byte)code } );
This will convert a string containing the hexadecimal representation of a number into a number, then it will use the current ANSI encoding of the system to turn that number into a character.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi,
Where can i find some tutorial on the subject of getting info on the hardware of my machine and how to change the settings.
Thanks
|
|
|
|
|
wrong place....
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)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Are you saying he will find the info at the wrong place
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
no i said its wrong place to ask that question... that 2 words make sense to understand what i have said
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)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|