|
Probably by writing some code. But you need to give a much clearer explanation of your problem if you want some help.
Veni, vidi, abiit domum
|
|
|
|
|
mory_260 wrote: how to create wordlist For which purpose? If you're looking for something that generates passwords, try a "normal" dictionary and specific character-replacements.
mory_260 wrote: contain full character on the keyboard A key on the keyboard is usually responsible for more than one type of character. One can even type characters that aren't present on the keyboard, using an alt-numeric combination or an application like Windows' charmap.
With strings containing UTF16 characters, there's quite some more characters than keys
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi there !
I want to not allow at Space the First of TextBox Like this :
TextBoxText=" Test";
in key_Pressed event i wrote this :
if ((sender as TextBox).SelectionStart == 0)
e.Handled = (e.KeyChar == (char)Keys.Space);
else
e.Handled = false;
but it doesn't work .
thanks any help .
|
|
|
|
|
Well, you never specified where this code was, so I'll assume it's in the code for the form. That;s the wrong place to put it. Normally you would put code like this in a class that inherits from TextBox and create your own version of the TextBox to use. Then this code would go into the KeyPressed event handler of this new class.
|
|
|
|
|
Let the KeyPress event execute - just trim the textbox e.g.
(sender as TextBox).Trim()
|
|
|
|
|
Almost, it would have to be:
(sender as TextBox).Text = (sender as TextBox).Text.Trim();
But you would also have to check that .Text is not empty or null first.
|
|
|
|
|
|
Abhinav S wrote: just trim the textbox My esteemed colleague, Abhinav,
Using 'Trim you are giving away a free gluteoplasty with every KeyPress ! Marketing is going to hate that.
bill
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
Not a good idea. What happens if you want to put a space in a word as you type?
|
|
|
|
|
Please post specific coding questions, like this one, in the Q&A forum, thanks.
Since (to the best of my knowledge) you cannot now delete this question here, and repost it in Q&A, I'll respond.
First, if you want to create a re-usable TextBox because: you want to use many TextBoxes that behave like this; my esteemed colleague Dave K. is absolutely right when he advises you to make a TextBox Control Class that inherits from Windows Forms TextBox.
If you don't know how to effectively sub-class WinForms Controls, please research Codeproject, the VS 201#x documentation, and MSDN, for information on creating your own Components, or UserControls. If you have problems with understanding, or implementing, them: ask them here on Q&A.
Here's some sample code that just modifies the behavior of one specific TextBox, 'textBox1:
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (textBox1.SelectionStart == 0)
{
if
(Char.IsWhiteSpace(e.KeyChar))
{
e.Handled = true;
}
}
}
Note: that you don't need to explicitly set e.Handled to 'false because 'false is the default value.
If you only want to suppress the space-character, and you want to allow tabs, or cr/lf's to be typed at position #0 in the TextBpx: then change the code above.
And, something you might think about: what happens if the user pastes text in, at position #0 in the TextBox, and the pasted-in content begins with spaces, tabs, etc. ? Try that, using the code above, and observe
Resources you should review: [^],[^],[^].
bill
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
thanks
|
|
|
|
|
Bill, there is no reason that this question is not suitable for this forum.
|
|
|
|
|
Pete O'Hanlon wrote: Bill, there is no reason that this question is not suitable for this forum. Hi Pete,
I must, respectfully, disagree: this is a language-specific "general programming" forum; the design of CodeProject (originally, anyway), for a good reason, had both a C# Q&A forum, as well as this "general programming" forum.
I am sure the intent of having two types of Forums, with two very different facilities ... one having formatting-free back-and-forth commenting, and a whole different voting structure with a range of scoring levels, and a way for the user to "accept" a given answer, and the other operating like all the other non Q&A forums ... was to have a place where, on the one hand, there could be substantive discussions of broader aspects of the use of the C# language, or, more advanced problems in programming that involved advanced concepts in C#. (this forum), and the other (Q&A): a place for specific programming questions of the "how do I ?," "how can I ?," "I'm stuck trying to" forms.
In practice, however, this forum has become a place where there is a creep-in of the type of questions that are best-suited for Q&A.
The analogy I'd use is: once a master-gardener designed two adjacent gardens, for very different purposes. One garden was intended for rare plants that needed special care, and where gardeners could meet to have educational discussions about the best gardening practices in taking care of both ordinary, and the "rare" plants.
The other garden was designed for common plants, plants for which gardening was a simple matter, and a place where those beginning to garden came to learn the basics of gardening, by hands-on practice, and having the opportunity to work alongside more experienced gardeners.
Using this analogy, I would say that, now: the strong hedge-row between the two gardens has collapsed, and many of the rare plants have stopped their rare blossoming, and both gardens are over-run with weeds and gardeners-gone-starkers who claim to be virtual incarnations of the original gardener, themselves, and run virtual 24-hour radio-stations broadcasting their grandiosities
Isn't the "downfall" of Q&A reflected clearly in your own admission on CP (sone time ago), that you withdrew from participating in Q&A, yourself, because you were uncomfortable with what was happening there ?
It's fine with me if CM changes the whole structure around. It's quite possible the time has come for that (?).
But, I feel it's entirely legitimate, and not disrespectful, to suggest to posters on this forum that their type of post is best-served, for both them, and CP, as a whole, on Q&A.
yours, Bill
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
You do know that the QA forum is relatively new don't you? For years, this forum did the job perfectly well. The intent of this forum was always intended to be the back and forth, as was best suited to by a forum format, where the thread can build out the answer.
|
|
|
|
|
Pete O'Hanlon wrote: the QA forum is relatively new Hi Pete,
I joined CP exactly one year before you did, but I have such great respect for you that I'd pick your view of CP's Forums' history and QA's inception over mine ! You have been a "prime mover" on CP, in my eyes, while I regard my walk-on role as that of a "spear-carrier in the third act" who often speaks-in-tongues when he's supposed to be: silent
If you tell me that you think I am doing a "bad thing" by advising people here to post on Q&A, and you don't share my view about what's happened with this forum, and Q&A, I will certainly re-evaluate my views, and very likely change my behavior. I wonder if, in your eyes, my advising people to post on Q&A, as I think appropriate, is kind of a presumptuous act on my part, a kind of lese majeste ?
But, may I ask: isn't the reason you gave (a while back) for your own withdrawal from Q&A provide evidence that you think the "system," as is, may need to be changed.
Perhaps changed, not because it is "broken," but, changed, because times have changed, the membership of CP has grown exponentially, and different modes of member behavior have emerged.
I remember this forum as a place, long ago, where substantial discussions of bigger-picture aspects of C# were discussed in depth.
Perhaps I am (as Rene Dubos, in his book, "The Mirage of Health" describes, a la Rousseau) imagining this forum had "golden age" in which humanity was more "noble," and lived "at one" with nature ?
In any case, please be assured that your opinions are valued, and will be heeded, after careful consideration.
In fact, as of now, I will no longer advise anyone on CP to post on Q&A.
yours, Bill
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
BillWoodruff wrote: But, may I ask: isn't the reason you gave (a while back) for your own withdrawal from Q&A provide evidence that you think the "system," as is, may need to be changed.
My withdrawal from Q and A had more to do with the personalities and ego crashing that do the rounds there. While the forums can occassionally bring out the jerk in people, this seems to be a much more common feature in QA. I do not like the fact that people have taken it as a playground to put others down, and the fact that someone does not ask a perfect question the first time round should not lead to them being told they have asked the wrong question, or that they are stupid, or any one of a hundred other things guaranteed to put people off CP.
The beauty of the forums, is that if someone doesn't ask a perfect question, or more information is needed, the thread view easily allows for that expansion of the idea so that people can see how questions evolve to their answers, and this can be an invaluable aid. Saying that, the forums aren't perfect, and there is a place for QA - and I admire people like yourself and OG for continuing to fight the good fight over it. (BTW - as to the creation of QA, I remember the bitter arguments Luc had with Chris when QA came into existence - QA being part of the reason, I believe, that Luc left our little fold).
|
|
|
|
|
BillWoodruff wrote: my esteemed colleague Dave K
"Esteemed colleague"?? Crap, now I have to act respectable.
Great job on the answer!
|
|
|
|
|
Uhh, homie, nah, man: respectable ? ... I ain't down 'wid that. I got to throw my old bones to some dawg, because they creakin' mighty on me; ain't hardly no use in 'em nowadays. You be a grand organ, man, playing formal to kinky pushin' and pullin' all yo' stops: thass yo' thang.
bill
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
protected void textBox1_TextChanged(object sender, EventArgs e)
{
if(textBox1.Text.Length > 0)
{
textBox1.Text = textbox1.Text.TrimStart(' ', '');
}
}
|
|
|
|
|
The problem with your answer is that it's not reusable and doesn't account for other whitespace characters that may not be acceptable, like Tab.
If you wanted to do this for multiple textboxes, you would have to add this code for each and every textbox. It's FAR better just to make your own TextBox that has this functionality.
|
|
|
|
|
You could place this code in the TextChanged event or OnKeyDown event (or you could use it whenever you want)
string myString = textBox1.Text.TrimStart()
or even straight to the point
textBox1.Text = textBox1.Text.TrimStart()
|
|
|
|
|
smh1392 wrote: I want to not allow at Space the First of TextBox Talk about a time-waster.
Not worth the money nor the effort. Especially not if it becomes a dirty hack that causes more pain to the user than it's bringing back in benefits.
If you "need" the functionality, then "correct" the data when saving, not when the user is editing.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hello!
I realized that MC did not create any Sound-Management Class, so
I don't know how to check which sound-output device is currently activated [standard-device, Not standardcommunication-device].
Are there extern libraries / classes that support my asked feature?
|
|
|
|
|
|
urgent need of online hotel managment project in .net if anybody have online hotel managment projectin .net then send me on following email id : chundavatteena@gmail.com pls guys send me project urgent chiye
|
|
|
|
|