|
Code Complete is a very good book for general style issues.
<blockquote class="FQ"><div class="FQA">Stark DaFixzer wrote:</div>lbl1.Text = Environment.GetFolderPath(Evironment.SpecialFolder.Personal);
lbl2.Text = Environment.GetFolderPath(Evironment.SpecialFolder.Desktop);</blockquote>
All that sucks about this is the variable names.
Stark DaFixzer wrote: public class SpecialFolder
{
private static string [] SpecialFolders = null;
static SpecialFolder()
{
SpecialFolders[0] = Environment.GetFolderPath( Environment.SpecialFolder.Personal);
SpecialFolders[1] = Environment.GetFolderPath( Environment.SpecialFolder.Desktop);
This is a waste of time in my book. All it does is rewrap something that is already exposed by the framework, and it obsfucates it. Unless there's ever a chance you want to change where SpecialFolder.Desktop points, it's just a waste of time to do this.
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 )
|
|
|
|
|
thank you Mr.Christian Graus
I will download this book ,
by the way ( may be the Specialfolders Class waste of time ) but the good practice would help you in the future to solve the big prb's
kind regards ...
I know nothing , I know nothing
|
|
|
|
|
Stark DaFixzer wrote:
I will download this book
I hope you mean you will buy it.
Stark DaFixzer wrote: by the way ( may be the Specialfolders Class waste of time ) but the good practice would help you in the future to solve the big prb's
Yes, centralizing things so you can change them app wide in one place is a good practice. Good practices adhered to blindly become bad practices.
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 )
|
|
|
|
|
hi
1. how can i color line in one color and other line in another color ?
2. how can i pic more than 1 line, and use them ?
thanks for any help
|
|
|
|
|
Hi
I am using C# .NET 1.1
---------------
1 - Use this option at your gridview properties
"AlternatingBackColor" , ( this for your Question )
"BackgroundColor" ,
"GridLineColor" ,
2 - I will back to answer as soon as possible , sorry
kind regards ...
I know nothing , I know nothing
|
|
|
|
|
1. Datagridview has got a property called DefaultCellStyle which is used to control how cells are rendered in that row.
2. Use MultiSelect property of Datagridview class. You can find selected rows by using SelectedRows property. Intuitive, isn't it?
|
|
|
|
|
i try, but i dont see any change in colors
i work in VS2008 and programing in c#
|
|
|
|
|
Can you post snippet of your code? Also, do the rows contain data?
|
|
|
|
|
Hi,
I want to pop up a reminder kinda pop up from the right bottom task bar when a button is clicked on the UI. Like an outlook "you have a new message" kinda popup.
How should i do it under button click event. ?
Thanks
|
|
|
|
|
Create a notify icon for your app, then look at the NotifyIcon.BalloonTip method.
Kristian Sixhoej
"Failure is not an option" - Gene Kranz
|
|
|
|
|
Hi All,
I am using C# 2.0 and I need to add following functionality to my application: User should be able to attach/detach component and move them around just like in visual studio. Please help if you can.
Thanks in Advance.
A.Asif
|
|
|
|
|
|
I am trying to customize my repeater control for my web application.
I am trying to add the column headings for my control using
<thead bgcolor="#66ccc">
<th></th>
I am getting the following error for the <th> tags..
Per the active schema, the element 'th' cannot be nested within 'thead'
I dont know what i am doing wrong?? please help?
(I have created a schema for my XML file)
BTW <tr></tr> tags are working fine.</th></thead>
Cheers
|
|
|
|
|
The error should be fine to ignore, I get those all the time.
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 )
|
|
|
|
|
I finally got my project done, sorry i should have said we got my project done... thank you so much, i know i couldn´t have done it without your support and help. We got A+ and my professor loved it and thought it was the best project presented to him during last december 1st.
I can´t express with words my gratitude to each and one of you but please accept this: Thanks!!!
Thanks for helping me become an engineer and finish college!!!
Sincerly best regards,
Luis E Tineo S
|
|
|
|
|
Glad we could help. Hopefully you'll stick around CP and contribute to this fine community.
|
|
|
|
|
Of course my friend. I started to work on building an small library and so far so good.
I would like to learn C# and add some knowlegde of Visual Basic and ASP to help as much as people as i can.
There's not way i won't be trying to help somehow!!!
Thanks Again!
Luis E Tineo S
|
|
|
|
|
glad to know, keep going my friend :^: :^:
Becoming Programmer...
|
|
|
|
|
I'm new to the thread concept so I apologize for what could be a simple question.
I have a process where I am creating a variable number of graphics objects (balls), each running in their own thread (not a ThreadPool).
As each object moves and bounces around the screen, I would like to check if the existing ball intersects any of the other balls. If they do, I need to remove the colliding balls, I assume using Abort.
I have been trying to see if I can loop through the currently active threads and compare using Rectangle.Intersects but I have not seen any references on a thread collection.
Any ideas or suggestions would be appreciated.
|
|
|
|
|
You can maintain a static list of ball objects that is available to all threads and use it to compare for intersection.
I am curious as to how many processors you have? Usually for such a scenario all of the thread logic would be handled via one thread and the drawing in another. That is really the simplest scenario.
To really split it up you need to seen each thread a region of control (not a ball) and have the thread check regions of control for intersections and then pass control to another entity to check for intersections when balls hit boundaries on regions of control.
Best bet, just use one thread for balls and one for UI. Also, use a rectangle for collision testing first to significantly increase performance.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
Using threads this way is a bit odd. Typically you would use one thread and then tick the entire simulation. You will get *strange things* happening if you are ticking different parts at different rates, and having balls interact with parts of a ball thats halfway thru its collision detection code. Expect to use a lot of locking to get things right.
If you are doing this as an exercise in threads - then look at keeping a dictionary of Ball to Thread around.
If you just want some bouncing balls then immediately throw this threading away and do it in a single thread that loops through all the balls.
|
|
|
|
|
Thanks for the responses.
It was an academic exercise but I think it was a fairly poor practical example of using threads.
|
|
|
|
|
I want get all the occurences for one string (e.g. keyword) in an ASP or html file. But I want to ignore some special html/asp tag that includes the searched string (in my case it is "keyword").
for example:
1) this is a test keyword string. (I want this)
2) <a href='#'>the is second keyword</a> (I don't want this)
2) <%
'this is keyword in asp code
%>
(I don't want this)
I know regular express may solve this problem. But I don't know how??
Can somebody give me an example regular exression for this??
Thanks a lot!
Alan Shen
MCAD for .NET Version
^~^~^~^~^~^~^~^~^~^~^
Great idea is the beginging of success!
|
|
|
|
|
Do the following, where 'keyword' is the search string (must have length of at least 2 characters)and 'str' is the file string:
bool inAsp = false;
bool inATag = false;
List<int> matches = new List<int>();
List<int> curGuess = new List<int>();
for (int i = 0; i < str.Length; ++i) {
char c = str.CharAt(i);
if (inAsp) {
if (EndingAspTag)
inAsp = false;
continue;
} else if (inATag) {
if (EndingATag)
inATag = false;
continue;
} else if (StartingAspTag) {
curGuess.Clear();
inAsp = true;
} else if (StartingATag) {
curGuess.Clear();
inATag = true;
}
for (int j = curGuess.Count - 1; j >= 0; --j) {
if (c != keyword.CharAt(++curGuess[j]))
curGuess.RemoveAt(j);
else if (curGuess[j] == keyword.Length - 1) {
matches.Add(i - curGuess[j]);
curGuess.RemoveAt(j);
}
}
if (c == keyword.CharAt(0))
curGuess.Add(0);
}
for (int i = 1; i < matches.Count; ++i) {
if (matches[i] - matches[i - 1] < keyword.Length)
matches.RemoveAt(i--);
}
</int></int></int></int> The code for the above conditions to check for entering or exiting an 'asp' or 'a' tag segment is non-trivial, as you also need to take into account whether you are within quotes, but you get the idea. This is also very inneficient, but it will work. Hope this helps,
-Jeff
|
|
|
|
|
Small Rat wrote: I know regular express may solve this problem. But I don't know how??
Can somebody give me an example regular exression for this??
Have you attempted to solve the problem yourself? This site isn't for people who want their work done for them. There's plenty of resporces on Regular Expressions available on the web. Have you looked at any of them.
BTW, I'm particularly surprised to see such behaviour from someone who claims to be Microsoft certified
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|