|
This is a better way still. Using execeptions is not a good idea.
private void AmountBox_KeyPress(object sender, KeyPressEventArgs e)
{
if(!char.IsNumber(e.KeyChar))
e.Handled = true;
}
|
|
|
|
|
if want to genarating report by using crytal report with microsoft access office,
got any ppl know how the coding writes?
my friend using database by microsoft sql can genarating report, but in microsoft access office is cannot.
y like that one?
|
|
|
|
|
got ppl know how to retrieve data from the cookie, by diffrence user get diffrence color??
private void btnselectedt_Click(object sender, System.EventArgs e)
{
DateTime dt = DateTime.Now;
TimeSpan ts = new TimeSpan(30,0,0,0);
HttpCookie mybg = new HttpCookie("bg");
mybg.Value = Convert.ToString(Session["assgroupID"]); //dotnot right or wrong, it try to bring ID
mybg.Value = ddlcolor.SelectedItem.Text;
mybg.Expires = dt+ts;
Response.Cookies.Add(mybg);
}
-------------------------------------------------------------------------------------------------------------------
string getbg()
{
return Request.Cookies["bg"].Value;
}
-------------------------------------------------------------------------------------------------------------------
...
...
if only can display in current page, but after logout already cannot retrieve form cookie. So, when login again cannot display
the bgcolor color that selected last time.
pls helping me what kind of problem on this coding, thank.
|
|
|
|
|
Lol. What is an "assgroup"?
What is it that you have in the session variable? Is it something that can be interpreted as a color?
Have you examined the html code that is produced, so see what value you actually get?
---
b { font-weight: normal; }
|
|
|
|
|
i use session to bring associatin group ID and store in to cookie, may be correct maybe wrong, becuase i also not sure
|
|
|
|
|
Hello,
I have an app that I use to get poll for the hostnames on my local network.
I use this method to get the information.
System.Net.IPHostEntry hostEntry = System.Net.Dns.GetHostByAddress(address);
The problem is that when GetHostByAddress(...) fails because there is no machine at a given IP address, it throws an exception that takes a long time (a few seconds).
Is there a faster method to call?
Is there a method that does the same thing, but sets an error value instead of throws an exception when a bad thing occurs?
Is there some kind of timeout setting that I can set to like 20 milliseconds? (I can be assured of always being on a lan with a fast response)
I use a whole bunch of threads to speed up the application, which makes the wait more tolerable, but it still takes way too long for my taste.
Is there a better method to use in .Net 2.0
Thanks.
|
|
|
|
|
Use the asynchronous BeginGetHostEntry method, it will not block.
(You can also use BeginGetHostByName , but it's marked as obsolete in .NET 2.0)
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi all, sometimes I need to raname e VS 2005 c# project but I receive several errors. Wich is the correct procedure to safely raname the project name, project directories an so on without having problems ?
|
|
|
|
|
|
excuzme.
in the name of god
hi.
c++ is famous for speed and running.
for graphic programing and game in next year c++ or c#?
how can i increase the speed of c# to speed of c++?
how dose not c# in commercial game?
|
|
|
|
|
ammoh - Microsoft is still actively improving the performance of the C# language and libraries. For information on using C# in scientific computing, check out this MSDN Magazine article[^]. The "Related Articles" section at the bottom of the page also provides some good advice on this topic. It's not too hard to relate these scientific computing concepts to gaming.
Good luck!
|
|
|
|
|
When Microsoft delved into writing LongHorn, the CLR team was given a directive by Bill. Make the CLR and C# run at C++-compiled speeds. This is probably a part of why it is slowly coming out. It is an undertaking, but the JIT now builds your IL AND optimizes the execution! I think you will find both languages coming out equal in speed.
|
|
|
|
|
hi
i have an app in which i can drop objects onto a form and move them, it consists of graphics (lines), i am using double buffering to avoid filckering in the parent control which is a panel,but when i add controls to this panel dyanamically, the double buffering effect is not there, i move all lines conneted to a control when the control is moved , at this time flickering occurs, please help.
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
How can i record sound in an applicaton in vs2005?
rzvme
|
|
|
|
|
Search the articles, there are several dealing with the topic.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi,
I wrote my user control to have my transparent image button using Windows forms.
For transparency, I need this:
protected override CreateParams CreateParams<br />
{<br />
get<br />
{<br />
CreateParams cp = base.CreateParams;<br />
cp.ExStyle |= 0x00000020;<br />
return cp;<br />
}<br />
}
and this:
protected override void OnInvalidated(InvalidateEventArgs e)<br />
{<br />
<br />
Transparenz zu erhalten<br />
this.SuspendLayout();<br />
this.Width--;<br />
this.Width++;<br />
this.ResumeLayout();<br />
<br />
base.OnInvalidated(e);<br />
}
and this:
protected override void OnPaintBackground(PaintEventArgs pevent)<br />
{<br />
}
It's working fine, but it flickers a bit. If there wouldn't be the overridden createParams, I could use double buffering. But, in this case transparency wouldn't work.
Do you know a way to have transparency and double buffering?
Regards,
Andreas
|
|
|
|
|
I have a listbox that a user populates. I want to only allow single spacing to be added to the listbox.
CSharpian
|
|
|
|
|
You can use a regular expression with the pattern " {2,}" to replace multiple spaces with a single space.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks alot That was a huge help. This is how I used it.
str1 = " spaces morespaces ";
str2= Regex.Replace(str1," {2,}", " ");
I noticed that it replaced every occurence of a mulitple space with a single space even at the beginning and the end. So I used:
str2 = Regex.Replace(str2,@"^\s*(.*?)\s*$", "$1");
to trim all of the leading and trailing spaces
Result:
"spaces morespaces"
|
|
|
|
|
You can just use str2 = str2.Trim() instead of writing your own regular expression.
|
|
|
|
|
Hi,
How can I cancel the current printing job from the printer spool using C#.
I tried to search but found unuseful information.
Could you please help me.
Thanks
|
|
|
|
|
I have a puzzle that would require some assistance by somebody who is knowledgeable about control arrays. If I had a control array of say 85 elements, and I would like to shuffle them so that they are randomized, is there an efficient approach that would work?
Initially, I would suppose that there would be a requirement to have two arrays, and that each element would be randomly "popped" off of the first array and placed (I forget the other term) onto the second array. Then, the first array would be re-dimensioned so that there would be one fewer elements. The procedure would continue until the first array contains zero elements.
Alternatively, as I recall there is some kind of Array.Randomize() routine. This would permit the randomization of one array without the need for a second array. Could one of you array gurus kindly provide some additional information and to fill in the blanks?
Say that I have an control array like so:
private Control[] controlName = new Control[85];
-- modified at 23:20 Friday 20th October, 2006
|
|
|
|
|
The following should do what you want.
Control[] controlName = new Control[85];
private void Shuffle()
{
ArrayList list = new ArrayList(this.controlName);
Random rand = new Random();
int j = 0;
for (int i = 0; i < this.controlName.Length; i++)
{
j = rand.Next(list.Count);
this.controlName[i] = (Control) list[j];
list.RemoveAt(j);
}
}
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thank you, Stefan. Here is a little twist. The elements of the control array are dynamically instantiated at run time. Is it possible to randomize elements from the control array?
|
|
|
|
|
I'm sorry, but I don't understand your question. Could you rephrase it and/or explain in greater detail what you want to do.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|