|
Umm... what's the problem with that code? What's a stack overflow? (Sorry for sounding noobie...)
Thanks!
Darth_Sulfur (Sulfurik)
http://www.sulfurmidis.com
http://www.sulfursoft.tk
ftp://tsfc.ath.cx
http://tsfc.ath.cx
hotline://tsfc.ath.cx
|
|
|
|
|
|
It's... calling itself? How?
Thanks!
Darth_Sulfur (Sulfurik)
http://www.sulfurmidis.com
http://www.sulfursoft.tk
ftp://tsfc.ath.cx
http://tsfc.ath.cx
hotline://tsfc.ath.cx
|
|
|
|
|
public BeepCollection FileParams
{
get { return this.FileParams; }
}
Actually, this is same as BeepCollection FileParams_get(){ return FileParams_get() } . Do you see now how it is calling itself? Maybe you know recursion but you was confused by syntax of properties. Properties are syntactic thing only, in reality it generates setter (and getter) functions. Is it clearer now?
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
Set Breakpoint at
public BeepCollection FileParams
{
get
{
return this.FileParams;
}
You will see that you will never goes out of the body
Of FileParams Property because the Body Call The
Property again and so on
This Like you wrote somthing like
public int Sum(int i,int x)
{
return Sum(i,x);
}
this will still sum i and x and
MCAD
-- modified at 20:50 Saturday 27th August, 2005
|
|
|
|
|
this property call its self but why did not throw
StackOverflowException
MCAD
-- modified at 20:58 Saturday 27th August, 2005
|
|
|
|
|
Well, is there a better way to do it? I really can't figure it out, I thought that was the correct way to do it... Thanks!
Darth_Sulfur (Sulfurik)
http://www.sulfurmidis.com
http://www.sulfursoft.tk
ftp://tsfc.ath.cx
http://tsfc.ath.cx
hotline://tsfc.ath.cx
|
|
|
|
|
Return the member variable that actually backs up that property, instead of returning the property itself, which is what is causing infinite recursion.
class X
{
string fileName;
public string FileName
{
get { return fileName;
}
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
And what's my "member variable"? All I have is the FileParams...
Thanks!
Darth_Sulfur (Sulfurik)
http://www.sulfurmidis.com
http://www.sulfursoft.tk
ftp://tsfc.ath.cx
http://tsfc.ath.cx
hotline://tsfc.ath.cx
|
|
|
|
|
You need to Declare class member like
private BeepCollection beepCollection;
and the Change the implementaion of FileParams Property
to
public BeepCollection FileParams
{
get
{
return beepCollection;
}
set
{
this.Lines = this.FileParams.Count;
this.beepCollection=value
}
}
MCAD
-- modified at 13:21 Sunday 28th August, 2005
|
|
|
|
|
THANK YOU ALL!!!
It works! Now I can keep on working on this! Thanks!
The program's homepage: http://www.BeepXtreme.tk
Darth_Sulfur (Sulfurik)
http://www.sulfurmidis.com
http://www.sulfursoft.tk
ftp://tsfc.ath.cx
http://tsfc.ath.cx
hotline://tsfc.ath.cx
|
|
|
|
|
Dear All,
I have the following issue...
I need to call a function from an unmanaged dll...
One of its input parameters is described as follows;
CvContourRetrievalMode as the datatype name
and it takes one of four values{CV_RETR_TREE...etc}
so shall I define it as enum or what?in msdn I found only examples for strings,structs and classes?any suggestions?
Thanks and Best Regards,
E.A.
|
|
|
|
|
|
|
hi, i use a Text Box...can i underline some text in the text box?
For example when i have:
Hello how are you?
i want to underline Hello and you...
maybe its possible...
cu
|
|
|
|
|
|
As above message suggested use richtextBox
if you select some text by mouse or keyboard
you can write somthing like
private void button2_Click(object sender, System.EventArgs e)
{
richTextBox1.SelectionFont=new Font(richTextBox1.SelectionFont,
richTextBox1.SelectionFont.Style ^ FontStyle.Underline);
}
Note:
Use ^ Operator Not | Operator this will allow you doing the reverse
if th selected text already underlined it will remove underline style
you can select text programatically by using
richTextBox1.Select Or richTextBox1.SelectAll
MCAD
-- modified at 20:02 Saturday 27th August, 2005
|
|
|
|
|
hi, ok i will try this, but when i dont want to use select...
any idea how only to underline one word in the richtextbox?
cu
|
|
|
|
|
surfman19 wrote:
i dont want to use select
Why you don't use Select?
Select tell richtextbox which text it will be formmated
by given style
surfman19 wrote:
how only to underline one word in the richtextbox
can you give example if you want to underline hello
for example you need to search for it and select it
and change underline style
MCAD
|
|
|
|
|
i thought the user must select, but if i can do that automatically its ok!
i will try it...
cu
|
|
|
|
|
What you do is you get the current selection and save it, then select the word you want to format, change the formatting, and restore the original selection. The user won't notice at all.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
If you want to select Hello word and change underline
programatically you can write some thing like
int pos=richTextBox1.Text.IndexOf("Hello");
if(pos != -1)
{
richTextBox1.Select(pos,"Hello".Length);
richTextBox1.SelectionFont=new Font (richTextBox1.SelectionFont,
richTextBox1.SelectionFont.Style ^ FontStyle.Underline);
}
if you want to select all Hello words in string and change its style modefiy the code and use loop
MCAD
-- modified at 8:16 Sunday 28th August, 2005
|
|
|
|
|
hi,
how can i pass a parameter to a thread function? maybe a little sample is not so bad...
cu
|
|
|
|
|
You can Create your thread function in class and pass
The Parameters to the class Constructor
For Example
<code>
public class Test
{
private string firstName;
private string Lastname;
private string fullName;
public Test(string fn,string ln)
{
firstName=fn;
Lastname=ln;
}
public string FullNameProp
{
get
{
return fullName;
}
}
public void FullName()
{
fullName=firstName + " " + lastName;
}
}
</code>
Then create instance from this class and path FullName Method to ThreadStart
you can access FullNameProp to get the result value
another method you can use Asynchronous Calls
Note:
this code i typed it here directly so review it
MCAD
-- modified at 18:29 Saturday 27th August, 2005
|
|
|
|
|
hi, thx a lot!
can i start the threat like that?
<br />
Thread worker = new Thread(new ThreadStart(FullName));
worker.Start();
why is public void FullName(), fullName, fistName and lastName not static?
cu
|
|
|
|