|
Suamal wrote: CheckRegExPattern
What is this? I didn't find it.
Suamal wrote: using System.Text.RegularExpressions;
public static bool CheckNumeric(string strText)
{
return CheckRegExPattern(@"^[0-9]+$", strText.Trim());
}
While taking idea from this I tryed to implement it like this:
using System.Text.RegularExpressions;<br />
public bool CheckNumeric(string strtext)<br />
{<br />
System.Text.RegularExpressions.Regex rr = new Regex(@"^[0-9]+$");<br />
return rr.IsMatch(strtext); <br />
}<br />
<br />
MessageBox.Show(this.CheckNumeric(TextBox1.Text).ToString());
Its working, but i'm unable to interpret this @"^[0-9]+$"
Thanks and Best Regards
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
At last found the site
.NET Framework Regular Expressions [^]
Thanks God
and Thanks to the forum
_____________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
Hi,
I need to write a windows service that will take a backup of the database tables and their data to a file when the server goes down and at the end of day everyday. Can anybody tell me how do I go about it? For the back-up do I need to use SQL-DMO or is there some other way out?
Thanks in advance,
Aakar.
|
|
|
|
|
For my money, SQL-DMO is the way to go. It allows you to stay within the confines of the application and is just a cleaner implementation (IMHO!)
I attempted to invoke sqlo from within C# and it did work, but catching any exceptions was a bit awkward.
/dave
----
If you always do what you always done, you'll always get what you've always got - Anonymous
|
|
|
|
|
My application saves the Size and Location properties of the main form in a configuration file. When the program runs I first create the form, set the Size and Location properties, then call the form's Show method.
I noticed after closing and restarting the application the form would grow slightly larger, which puzzled me. If I output the value of the Size property immeadiately before and after I call the form's Show method I can see that the form grows in height by exactly 19 pixels. No matter what I set as the value of the Size property, the height always seemed to increase by 19 pixels.
I had a hunch maybe 19 pixels was the height of the title bar. I increased the size of the title bar font in Windows, but my form still grew by 19. However, when I increased the size of the menu font my form grew by a larger amount.
Other than the menu I have two controls in the form. A ListView control with the Dock property set to Fill and a StatusBar control with the Dock property set to Bottom.
Any ideas?
Thanks,
Chris
|
|
|
|
|
Maybe you can try saving and setting the form's ClientSize instead.
I haven't done any testing but AFAIK the ClientSize does not include title bar height and width etc.
Edbert
Sydney, Australia
|
|
|
|
|
I had similar problem long time ago, but I don't remember exactly how I solved it. It was sort of the caption bar that added up every time.
- It's easier to make than to correct a mistake.
|
|
|
|
|
I am definately using Size, not ClientSize. I also believe it is the height of the menu bar that is being added to the form, not the height of the title bar.
|
|
|
|
|
Hello,
I have 11 instances of a control (representing 11 audio channels). This control has, among others, two public boolean properties called SOLO and MUTE. These can be turned on and off by means of two checkboxes, say, chkSolo and chkMute.
This is what I need to do:
1) If the user decides to "solo a channel", i.e. set the SOLO property on one of the controls to TRUE, the MUTE property of the other 10 controls should be set.
2) Unchecking the chkSolo box (setting SOLO to FALSE) should "unmute" the other 10 controls.
What's the best way of doing this? Should I have a collection of controls? How do I identify which of the controls is being Soloed?
Thanks for your help!
|
|
|
|
|
I'd say the best way is to create 2 user controls.
The first control should contain the channel, the checkboxes Solo and Mute. Let's call it Channel.
When chkSolo is clicked, the control should raise an event to notify it.
The second control should handle the collection of the first controls. Let's call it Mixer.
This control should handle chkSolo click event (preferably a custom event returning your Channel control); Everytime a chkSolo is checked, it needs to save (either the Channel control's index or a reference to the Channel control) which of the channel control is checked, and if it is to be soloed to go through the collection and mute the rest of the controls. If it is to be unchecked the rest of the controls should be unmuted.
Therefore, your Mixer will have handled the mute/unmute and you can get the control being soloed (if any) from it.
Edbert
Sydney, Australia
|
|
|
|
|
Edbert, thanks for your reply! Could you give me an example of what the code for the event and the second control (the collection of controls) should look like? Just an example would be great.
Thanks again!
|
|
|
|
|
Here's a small example (I'm blind coding, it might have some syntax error):
For Channel, you need to raise an event whenever the checkbox is checked:
public event SoloChangedHandler SoloChanged;
public delegate void SoloChangedHandler(Channel sender);
private void OnSoloChanged()
{
if (SoloChanged != null)
SoloChanged(this);
}
private void chkSolo_Checked(object sender, EventArgs e)
{
OnSoloChanged();
}
public bool IsSolo
{
get { return chkSolo.Checked; }
set { chkSolo.Checked = value; }
}
For Mixer, you need to either keep a reference on the selected Channel, or the index, or both:
private int selectedIndex = -1;
private Channel selectedChannel;
private void ctrlSolo_SoloChanged(Channel sender)
{
if (sender.IsSolo)
{
this.selectedIndex = this.Controls.GetChildIndex(sender);
this.selectedChannel = sender;
foreach (Channel channel in this.Controls)
{
if (channel != sender)
{
channel.IsSolo = false;
channel.IsMute = true;
}
}
}
else
{
this.selectedIndex = -1;
this.selectedChannel = null;
foreach (Channel channel in this.Controls)
{
channel.IsSolo = false;
channel.IsMute = false;
}
}
}
That's it. Now you just need to add properties to access the collection of Channels, the SelectedIndex, and the SelectedChannel.
Hope that helps!
Edbert
Sydney, Australia
|
|
|
|
|
I want to make a program to view some XML files. Right now just looking at the files is very confusing and intimidating to most people. I would like to make it more intuitive and easier to work with (the xml).
I'm in a planning phase right now, and was wondering what would be he more graceful way of doing loading the XML? I just want to do it with style.
The xml files are like this..
1 "package" root node
any number of "method" nodes
- one "paramlist" node per method
- any number of "params" per "paramlist"
- one "actionlist" node per method
- any number of "action" nodes per actionlist
that's pretty much the XML each node has few attributes too. I need to make a schema for it too.
So what would be the best way to convey the XML to a user? The only thing I can think of is a tree control. Any other ideas?
So how would I load the xml file each time? how would I save it from the tree?
I'm thinking seralization, does that sound right?
/\ |_ E X E GG
|
|
|
|
|
I'm trying to find a way to use the sql builder to make custom searches.
Basically I have a textbox that is for "item" and I'd like the content of that string used for a WHERE sql command. I can't figure out how to do this with the query builder though. Thanks!
|
|
|
|
|
No Idea's how to modify the stored SQL from Query builder using a custom string that can be build from a form object? :[
|
|
|
|
|
we are deploying a winforms application using ClickOnce (OnlineOnly)
how can i uninstall it?
any pointers in the right direction would be very much appreciated
|
|
|
|
|
c:\windows\downloaded program files\(your app to delete here)?
I'm assuming it would install something like shockwave or flash. If so, you can just delete the file in the folder above.
|
|
|
|
|
Hello I have the following error with VS2005:
"the following module was built either with optimizations enabled or without debug information..."
It just comes up from nowhere while i was debugging my program.
It just pops up whenever i try to run my program which is composed of 2 projects. I have an application project and a main project. With that warning any changes in the main project are not updated in the solution.
I tried to change the property to debug and it's not working. I tried to detach the main project and readd it back to the solution and it's not working. I also made sure that the application project refere correctly to the main dll in the main bin.
I try to look around and some people do have this kinda problem but it's more related to deployment which is not my stage yet.
Can anyone tell me what's going on?
Donkaiser
|
|
|
|
|
To debug this module, change its project build configuration to Debug mode. To supress this message, disable the 'Warn if no user code on launch' debugger option.
--
I've killed again, haven't I?
|
|
|
|
|
Where is the "warn if no user code on launch"?
Donkaiser
|
|
|
|
|
well I found the option. but i still need to manually remove the reference in my application and reAdd it after change in the main project. before after any changes in the core, all i needed was to rebuild the solution to make it work.
Donkaiser
|
|
|
|
|
I am not sure what created this error.
but the error which I got in my c# application says "Windows form exception Error creating windows handle". I dont know whether it exceded the number of handles but I am surprised that limit is atleast 1000 and I dont have 1000 controls on my form.My application has single form and
one tabcontrol with 7 tabpages. There are many callback event firing in the application these events populate the listboxes on each tabpage. I read it in some message forums that controls on tabpage does exceed the number of windows handle used. IF anyone has any idea about this issue please let me know.All responses will be highly appreciated.
Mandar Patankar
Microsoft Certified professional
|
|
|
|
|
Can you post the complete error message (i.e. the one in Exception.ToString() so that we can see what was being called)?
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Thanks for replying ed.
this is the error message
An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in system.windows.forms.dll
Additional information: Error creating window handle.
this error is random. Application works fine for some time and suddenly when you are switching between tab pages this error is raised.
Mandar Patankar
Microsoft Certified professional
|
|
|
|
|
Have you tried running it inside the debugger and investigating the current state of the variables. Take a look at the stack trace as well if possible (this should be included in the exception text). You'll just have to experiment and try and find out if there are any common things occurring at the same time as the exception (such as an object being null, stack overflow etc).
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|