|
I always appreciate your time that you volunteer to help others. I do believe that, you will get return in rewards for these good attitude and helping mentality.
And thanks for giving me courage.
|
|
|
|
|
I'm always happy to see you on the forum. Again this was just my opinion. I'm looking forward to seeing your company's website. Good luck.
Regards
|
|
|
|
|
Hi
How i can get control by names:
For example i have 3 textbox with name tb0,tb1,tb2
i need to fill them in loop how to do that??
for(int i=0;i<3;i++)
{
TextBox tb=???
}
GOod bye
best regards
when i want to read something good just seat and type it
|
|
|
|
|
Hello
To get a control by name use this.Controls["Controlname"] , like this
for(int i=0;i<3;i++)
{
TextBox tb= (TextBox)this.Controls["tb" + i.ToString()];
}
Yet such a loop doesn't have any error checking. You must make sure that the control is a TextBox using the is or as keywords.
Also if your textbox is in a container -eg. GroupBox-, Then it's inside the controls of that GroupBox not the form, ie.
TextBox tb= (TextBox)this.MyGroupBox.Controls["tb" + i.ToString()];
Regards
|
|
|
|
|
Thank's a lot
when i want to read something good just seat and type it
|
|
|
|
|
//if controls are on form
foreach(Control c in this.Controls)
{
if(c is textbox)
c.Text = "some text";
}
//if controls are in some container
foreach(Control c in this.ContainerName.Controls)
{
if(c is textbox)
c.Text = "some text";
}
i hope it works
ihtesham
|
|
|
|
|
Gee!! Thanks for your reply!
Only one problem is that it wasn't me who asked the question!!;P
He won't get a notification of your reply if you replied to me. Repost your reply by replying to his original post.
Regards
|
|
|
|
|
How can I change my system's Regional options (I want to change it to English-United states and also the datetime/currency formats) using c# code. If any one knows plz reply...urgent
Thanks in advance
Ranjith Stephen
|
|
|
|
|
Hello
I believe it's possible, yet not preferable!! Why, I won't like it at all if i install a program that misses up with my system's configuration. I'd start wondering what else did that program do in my system. Probable, I'd uninstall it immediately and make a system restore.
The real question isn't how. It's why?? Why would you want to do such thing?
My guess is that you are facing some trouble with the Date/Time or currency/numbers formatting, Right-To-Left issues and things like that. Post some details of your real problem, and maybe we can work it out, as changing the system's configuration to suit your formatting isn't the solution.
Regards
|
|
|
|
|
Hii thanx for ur reply. Bu t the thing is that I am modifying an existing appplication. There is a lot of calculations and using a lot of constants ( from ini files and hard coded strings .. etc). Moreover the application will be running in a dedicated system and there is no question of restoring it.
I searched for API s which enables me changing the settings but i couldnt find any
Do you know any ???
thanks and Regards
asdasd
|
|
|
|
|
Hello
You can't change the systems locale perminantly using any API -it would take much more than that to hack into windows restricted settings-. Anyway you can make a workaround it by changing the locale to your app's session only. Check Win APi SetLocaleInfo() function.
Regards
|
|
|
|
|
Hey It is possible..I mean no need to change the systems settings, but the application enviornment as you said .
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US" , true);
will set the application settings into en-US , and our application will work in en-Us format
Thanx
Ranjith Stephen
asdasd
|
|
|
|
|
I mean for example when I use webbrowser control,set the control size 400X300,then navigate the webbrowser to a webpage,and the whole page is displayed in the control,but have scrollbars,so can i scale or shorten the whole page to 400X300.
I hope you know my meanings.
Thanks.
|
|
|
|
|
Hello
I've never seen in before in any browser -this zomming/fit page thing- so I don't think It's avaible directly in the WebBrowser control.
I guess you'd have to make you own Browser object that parses HTML and displays it accordingly. Won't be easy though.
Regards
|
|
|
|
|
Hey everybody !
I'm trying to find a way to get my IP.
I'm pretty sure there is a method for that in the libraries, so I thought maybe someone wouldn't mind to share that information .
Thanks.
|
|
|
|
|
Very simple, Try this:
<br />
IPHostEntry host = Dns.GetHostByName(Dns.GetHostName());<br />
foreach (IPAddress address in host.AddressList) <br />
{<br />
Console.WriteLine("IP Address: {0}", address.ToString());<br />
}<br />
You must include the System.Net namespace as well.
|
|
|
|
|
Thanks
its working perfectly!
by the way, just one more thing, is there a way to tell if the IP I'm getting is the internet IP? (if I have more than one), or do I have to find something (like checking the first number of the IP address)?
|
|
|
|
|
You might check if it's in the valid range of non-network IPs
Alternatively, you could send a HttpWebRequest to http://www.whatismyip.com/
If it succeeds then you can parse the IP. If it does not, you might still want to check method 1
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Good day
Im tring to uninstall an application using command prompt. After it has uninstalled, it must not show on the Add/Remove Programs folder. Can anyone help me.
Thank you in advance
Kulile --- RSA
|
|
|
|
|
Is there a way to center text in a message box? Its left aligning it and Id rather have it centered if there is a way.
|
|
|
|
|
The text must be centered if the box grows to fit the text
You can use \n if you want CR's and manually "box" lengthy text that way.
Glen Harvy
|
|
|
|
|
Hi Guys,
I’m creating an animation program and have built a Bezier spline motion editor. The user-controllable curve plots time(x) against value(y). So my challenge is to retrieve the 'y' value from a given 'x' on the curve. However, all the articles I've been able to find/understand only give a formula for calculating an x or y from 't' - the percentage along the given cubic bezier curve.
As 't' is more concentrated around areas which heavily curve (to make a smooth curve), it's not possible to calculate y from x. So I'm using what seems to be a recognised work around and iteratively guessing at which 't' value produces x, continually reducing the difference until I find the correct 't' which produces my required x. I then use this 't' to calculate y.
This all works perfectly well. However, this is an animation program so I need to optimize this process. My current technique requires up to 15 iterations before it finds an accurate value for 't'. I found an article online by Don Lanaster, “Some more cubic spline math BEZMATH.PS”. He mentions using the Newton-Raphelson method to reduce this process down to 3 iterations. Apparently this technique uses the slope of the curve to make the approximation of 't' more accurate. However, the formula he uses doesn't match the formula I currently have working to calculate a value on the curve. I'm sure I'm misunderstanding it!
At this point I have to confess I am a Math dummy. I can work my way around practical mathematical issues as long as I don’t have to resort to long formulas full of ancient Greek!
Here's an extract from Don's article:
--- Quote ----
Let's use a better ploy to get our approximation to close quickly. It is called the NEWTON-RAPHELSON method, but is much simpler than it sounds. Say we get an error of x - x1. x1 is the current x for our current guess. At x1, our spline curve has a slope. Find the slope.
The slope is expressed as rise/run. Now, on any triangle...
rise = run x (rise/run)
This gives us a very good improvement for our next approximation. It turns out that the "adjust for slope" method converges very rapidly. Three passes are usually good enough. If our curve has an equation of...
x = At^3 + Bt^2 + Ct + D
...its slope will be...
x' = 3At^2 +2Bt + C
And the dt/dx slope will be its inverse or 1/(3At^2 + 2Bt +C). This is easily calculated. The next guess will be...
nextguess = currentt + (curentx - x)(currentslope)
----- end quote ----
So here's the function I call iteratively with varying values for 't' and it returns 'x' for me to compare with what I want:
public float CalcBezierValue(float t, float A, float B, float C, float D)
{
t = 1 - t; // Reverse the normalised percentage
float F1 = t * t * t; // These vars used purely for visual clarity
float F2 = 3 * t * t * (1 - t);
float F3 = 3 * P * (1 - t) * (1 - t);
float F4 = (1 - t) * (1 - t) * (1 - t);
return A * F1 + B * F2 + C * F3 + D * F4;
}
As you can see the base formula which produces the return value is quite different from the one in the article (x = At^3 + Bt^2 + Ct + D). Consequently I’m failing to comprehend how to calculate the slope value or its inverse which seem to be required to reduce the number of calls to this function.
Can anyone help me?
Many thanks for your time,
Simon
-- modified at 12:02 Wednesday 13th September, 2006
|
|
|
|
|
You choose wrrong forum brother try it in google groups but math
when i want to read something good just seat and type it
|
|
|
|
|
Thanks for the tip. I've posted on there too.
|
|
|
|
|