|
http://www.codeproject.com/dotnet/activedirusers.asp
|
|
|
|
|
I hope someone can help me... I'm a newbie to C# and loving it but i'm kinda stuck.
I have a multiline textbox and what i would like to happen is when i click on the "new" button that it prompts you to save if there is any text in the textbox. but i'm not sure how to go about it. any suggestions would be appreciated.
Regards Aj
Aj...
|
|
|
|
|
In the button click event, check the .Text property of the textbox and see if it is empty or not.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: In the button click event, check the .Text property of the textbox and see if it is empty or not.
as a newbie i must ask how do / would i do that??
thanks
Aj...
|
|
|
|
|
I'm assuming here that you've already created the Click event for the button. If you haven't then you need to do this first. Then, assuming your textbox is called myTextbox, you would type something like this:
if (myTextbox.Text.Trim().Length != 0)<br />
{<br />
}
The Trim() removes any spaces from the end of the text. If the user had just pressed space, this would ensure that the messagebox was not shown.
There are many ways to accomplish this test. You could test to see if myTextbox.Text.Trim() == string.Empty .
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Brilliant. Thanks for your help... It all falls into place now.
using Trim() ".Length !=0)" works where as "== string.empty" doesn't appear to do anything.
Once again thank you.
Aj...
|
|
|
|
|
"== string.empty" equals to true when the string is empty whereas ".Length !=0" equals to true when the string contains some characters i.e. isn't empty. Use "!= string.empty" to get equal result.
"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
|
|
|
|
|
Hi all
Im trying to get this regex to fit with dash but i wont work...
regex:
Regex r = new Regex(@"^(([a-zA-Z] |(\\[\w]+\-[\w]+)\$?)(\\(\w[\w ]*))+\.(cwp|CWP)$", RegexOptions.IgnorePatternWhitespace);
bold is the critical part tried:
(\\[a-zA-Z0-9-]+)
(\\[a-zA-Z0-9\-]+)
this is the path it should match...
C:\Documents and Settings\Cws-Cdh\My Documents\CW Projects\Test\test.cwp
Thanks in advance, chris
|
|
|
|
|
You are looking at the wrong part of the pattern. The bold is the part that will match the folder names:
Regex r = new Regex(@"^(([a-zA-Z] |(\\[\w]+\-[\w]+)\$?)(\\(\w[\w ]*))+\.(cwp|CWP)$", RegexOptions.IgnorePatternWhitespace);
---
b { font-weight: normal; }
|
|
|
|
|
Any1 can advise me what to do if i wan to search an item inside a ListView fill by a datatable according to what user type in a text box.
http://img.photobucket.com/albums/v608/mjay83/lookup.jpg[^]
above is a screenshot i taken from a software, i just wonder how they do it, user type inside the lookup textbox, then the list view will auto jump and point to the item which match or nearly match with the user input.
Any1 please?
|
|
|
|
|
The listbox responds to two messages:
CB_FINDSTRING and CB_FINDSTRINGEXACT
These messages are used to find a value in a listbox or a ComboBox.
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
It’s rather simple to write an unmanaged C++ application that crashes when it performs a callback. It’s impossible to write a managed application that does the same, thanks to delegates. - Jeff Prosise
|
|
|
|
|
sorry but i dun really get ur mean....
i am using a listview instead of a listbox
|
|
|
|
|
on text boxs textchange event u can try following codes
foreach(ListViewItem itr in listView1.Items)
{
if(itr.SubItems[1].Text==textBox3.Text)
{
//itr.Focused=true;
itr.Selected=true;
}
else
itr.Selected=false;
}
where subitems[1] is second column so u can write column number which u want to match
rahul
|
|
|
|
|
hi, thanks for reply
i gonna try tat out
but 1 thing is, my listview contains more than 7k item,
if using this way i think is quite not resource efficency
is there other better way?
|
|
|
|
|
Hi,
is there a simple way to copy/paste a ToolStrip at designtime from one project to another project without loosing all the events that are connected to the toolbuttons?
The code behind the events is existing in both projects. When I copy the toolstrip in project1 and paste it in project2, the toolstrip with all buttons will be copied but not the events that are linked to them
I am working with VS2005 and C#
Thanks
Dirk
|
|
|
|
|
You could copy/paste the concerned code from/to the InitializeComponent method.
"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
|
|
|
|
|
I feared that this will be the answer It's not my favourite solution as it is time consuming and error-prone, but obviously the only way to copy controls from one app to the other.
Thanks anyway
Dirk
|
|
|
|
|
I had a look at the Drawarc method but i can't understand a thing. I need a draw arc method that requiers : the coordenates for the center of the circle, the radius and the angle it sweeps!
rzvme
|
|
|
|
|
It's not that hard.
Instead of a center point and radius the method takes a rectangle which specifies the bounds of the arc. Imagine it the other way round. You have an arc and put a rectangle over it so that the arc touches all sides of the rectangle.
It's simple mathematics to calculate the dimension and position of the rectangle from a center point and radius.
Furthermore the two angle parameters shouldn't be that hard to understand. If the textual description isn't sufficient, simply experiment a bit with them.
"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
|
|
|
|
|
Hi, I am using ReportViewer reports for my reporting.
I want to use the Image control(instead of Chart control) report item to draw the graphs. I need a drawing surface to draw the graph using methods from Graphics Class and show it in the Image control when I view the report . Thanking you in anticipation.
Ramith Sivanarain
|
|
|
|
|
Hi,
Can any one help me in changing the attribute value of a child attribute when the parent attribute value is changed .
eg
parent property
[readonly(true)]
parent {get{return child;}set{child =value;}}
child class
class child
{
a {get{return 1;}set{1 =value;}}
}
for this eg if i channge read only attribute for parent it should affect child also,
Thank you
regards
Praveen
|
|
|
|
|
Create an event and fire it when parent properties get changes.in that event pass the object of parent classs.Now you can set you desired child Properties
|
|
|
|
|
hi,
I guess you understood wrongly what i meant was
if i change read only attribute for parent it should affect child also,
eg
parent property
[readonly(true)]
parent {get{return child;}set{child =value;}}
child class
class child
{
a {get{return 1;}set{1 =value;}}
}
Thank you
regards
Praveen
|
|
|
|
|
praveenqwe wrote: if i change read only attribute for parent it should affect child also
Hi Praveen,
What sam# suggest, is right. See this[^] and this too[^]. Hope these articles may help in giving you a solution.
By the way, what is the meaning of this:
praveenqwe wrote: a {get{return 1;}set{1 =value;}}
also, my c# compiler gives me an error on the statement 1 = value; , which is The left-hand side of an assignment must be a variable, ...
Regards
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
Hi ,
I want to open the foder. That is on a button click
I want to show folder open in explorer. How to do that?
Rahul Kulkarni.
|
|
|
|