|
I have always added a "Settings" File to my project. Then used the Property Grid control to allow users to view/edit the Settings.
I'd like to allow for a cleaner configuration interface. (The property grid is just an table of all the options listed in alphabetical order) I'd like to be able to group options together and have things like checkboxes instead of True/False selections)
I have spent several hours searching for a good approach to binding windows forms controls to a Settings file or similar and surprisingly haven't come across anything quite like what i was looking for.
I did find some asp.net articles which allow for XMLDataSets to be binded to a form but this option doesn't appear to be available in C# Windows forms projects.
If someone could point me in the right direction, i'd really appreciate it.
Thanks in Advance,
~blake
http://www.blakerobertson.com
|
|
|
|
|
Hi,
My application working fine in the dev environment.But in the testing /production environment
it is not working because that environment has only
windows server 2003
IIS
I have prepared a MSI which will automatically install .net2.0 framework
In my application I have Used some microsoft VC++ dll's also along with .net dll's.
Now Iam getting "<b>RUNTime Error</b>" pop-up screen message as below
" <b>The Application has been terminated in an Unusual Way</b>"
On googling i came to know that some dll's like msvcrt.dll of windows server 2003 has to be changed...But Iam not pretty sure about it..
In Production/test environment there is only framework installed ,but there is no visual studio installed on it.may be due that this error may occur...
So kindly post your suggestions and views to help me
|
|
|
|
|
|
I want to add item to my listbox if a mouse is clicked in the area between the two items. Is that even possible couldn't find anything on famous www.google.com.
|
|
|
|
|
Not sure, but have a test with MouseDown event, which will give you coordinates and GetChildAtPoint method.
The need to optimize rises from a bad design
|
|
|
|
|
If u want to add item from another list box then in mouse click event you copy that item to clipboard then paste to whr u wsant
|
|
|
|
|
Commonly used solution is making a context menu with add item. When a user clicks on list item and selects add you can prompt for information and add new listitem just before the one user clicked.
|
|
|
|
|
First of all thanks for answering to my question. I am already using context menu either (Addup or below). But I have realized, that I don't like this kind of feature. Wouldn't it be nice to display a blinking cursor (I-horizontal bar) within the listbox or may be in between the listbox items. Any insight would be kindly appreciated.
|
|
|
|
|
Is this a Windows or a Web application?
|
|
|
|
|
|
Since this is a Windows app, you can do it (would be impossible using the Web controls unless you developed a completely custom list control). In fact, the first reply you received mentioned the functions you need to do it.
|
|
|
|
|
But how am I going to show an I-horizantal Bar or Bliking cursor within the listbox.
|
|
|
|
|
netJP12L wrote: But how am I going to show an I-horizantal Bar or Bliking cursor within the listbox.
First, what do you mean by "I-horizontal bar"?
Second, draw the listbox then draw your bar or cursor OVER the listbox. This is best done with a control derived from the list box with an overridden Paint method.
|
|
|
|
|
I meant control focused cursor. Usually we have it vertially. Same like in Power Point. Or similiar like when a TextBox or TextField recieve focus, that's the cursor I am refereing too
|
|
|
|
|
netJP12L wrote: I meant control focused cursor. Usually we have it vertially. Same like in Power Point. Or similiar like when a TextBox or TextField recieve focus, that's the cursor I am refereing too
Ah!! You need to create a cursor.
1. First, create the cursor in Visual Studio. This can be done easily by right-clicking your project, selecting Add New Item, select Local Project Items\Resources\Cursor File, then edit and save your cursor (we'll call it Horizontal.cur).
2. To create the cursor in C# and make it the current cursor:
Cursor.Current = new Cursor("Horizontal.cur");
|
|
|
|
|
netJP12L wrote: First of all thanks for answering to my question. I am already using context menu either (Addup or below). But I have realized, that I don't like this kind of feature. Wouldn't it be nice to display a blinking cursor (I-horizontal bar) within the listbox or may be in between the listbox items. Any insight would be kindly appreciated.
Truthfully, twenty one years of experience developing user interfaces gives me the feeling that this idea reads much better than it will look two years into the application's deployment. Is this simply a play application not intended for serious use by a lot of people, or is this intended for commercial use?
|
|
|
|
|
I am trying to develop a free-ware photo album.
|
|
|
|
|
Currently I have some code that does some searches via the reg expression in c#. I have a fuynction that returns a reg expression that simply strings and clean the string from HTML tags and the function is below(1). This function works just fine. Recently the code has a bug and the bug seems to be related with the following:
- between words there are multiple spaces and/or multiple nbsp so if the user searches for the "this is" it does not give the right matches if in between "this" and "is" may be multiple spaces, combination of amp;nbsp; and spaces and carriage returns. I am trying to do a test and do the code below which works as a test:
string str = "This is a test sentese.";
str = Regex.Replace(str, @" ", " "); //Remove nbsp
str = Regex.Replace(str, @"\s+", " "); //Remove duplicate spaces.
but how can I add the above logic in one sentese? how can I add the above logic part of the regular expression that strips the HTML below? Please help.
1. Function that cleans from html:
public static Regex GetRegExpStripHTML()
{
Regex r = new Regex(@"(<\/?)(?i <element>a(bbr|cronym|ddress|pplet|rea)?|b(ase(f" +
@"ont)?|do|ig|lockquote|ody|r|utton)?|c(aption|enter|ite|(o(de" +
@"|l(group)?)))|d(d|el|fn|i(r|v)|l|t)|em|f(ieldset|o(nt|rm)|ra" +
@"me(set)?)|h([1-6]|ead|r|tml)|i(frame|mg|n(put|s)|sindex)?|kb" +
@"d|l(abel|egend|i(nk)?)|m(ap|e(nu|ta))|no(frames|script)|o(bj" +
@"ect|l|pt(group|ion))|p(aram|re)?|q|s(amp|cript|elect|mall|pa" +
@"n|t(r(ike|ong)|yle)|u(b|p))|t(able|body|d|extarea|foot|h|itl" +
@"e|r|t)|u(l)?|var))(\s(?<attr>.+?))*>");
return r;
}
|
|
|
|
|
A regex just searches for a pattern. Assuming the strip regex below is used to replace html tags with the empty string, you cannot use it to replace anything with a space.
You can combine two patterns like this:
str = Regex.Replace(str, @"( |\s)+", " ");
Also, your GetRegExpStripHTML doesn't work. It strips only a few well-formed known tags - that's not enough to prevent cross-site scripting exploits.
What about <SCRIPT> or < SCRIPT> ?
What about tags you forgot, like <BODY onload="...">?
What about encoding the characters using some far-east codepage that your app doesn't understand? The codepage auto-detection of the browser might detect the codepage and execute the scripts.
What about null bytes like <SCR\0IPT>? Your regex won't see the script tag, but Internet Explorer still does.
What about any of a huge number of other tricks to evade XSS filters?
You need to encode any < > &, a blacklist won't get you anywhere as browsers have lots of ways to execute code that you never heard about. And even that isn't 100% safe when playing with the charset tricks.
See http://ha.ckers.org/xss.html[^] to get an idea about what kind of attacks on XSS filters are possible.
|
|
|
|
|
the one that strips html is used only for some internbat clean up. that;'s fine. is there anyway I can add the patern you added above to that reg expression? please help?
|
|
|
|
|
You could take the huge pattern and append |( |\s)+ . But you cannot control what the pattern is replaced with - that's in some other place in the code, where the GetRegExpStripHTML().Replace method is called.
I would suggest removing the GetRegExpStripHTML() method and instead providing a CleanupHTML(string) method - that way, you can apply multiple regular expressions and don't have to do everything with a single replacement using a monster pattern.
|
|
|
|
|
Hi all, I am reposting this.Yesterday Mika had given me a solution, but for some reasons I can't do it that way because of some design constraints, and I have to do it this way only.
I have a form 'frmProgressBar', which is shown as popup using objfrmProgressBar.showDialog() from a class AppGlobals (AppGlobals.prpgressbar.show() method). frmProgressBar has a backgroundworker thread running, which keeps running till the processing in other forms is not compleated. I want to hide popup whenever the main form, on which other controls are loaded, is minimised and the popup is getting hidden also. But the problem is, when the main form is maximized, I want to show the popup form again. I checked !IsDestroyed for frmProgressBar which returns false, so the backgroundworker thread is still running, but the popup is not displayed in the foreground, only main form is shown. I tried Show(), BringToFront(), TopLayer = True, but nothing seems to work. Any help please.It is very urgent.
Following is my code :
bool bContinue = true;
public frmProgressBar(string Message)
{
InitializeComponent();
this.ShowInTaskbar = false;
lblMessage.Text = Message ;
backgroundWorker = new BackgroundWorker();
backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWorker_DoWork);
backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler (backgroundWorker_RunWorkerCompleted);
}
private void setWindowStateAccordingToMainForm(FormWindowState State)
{
if (this.InvokeRequired)
{
setWindowState d = new setWindowState(setWindowStateAccordingToMainForm);
this.Invoke(d, new object[] { State });
}
else
{
if ((State == FormWindowState.Maximized) || (State == FormWindowState.Normal))
{
if (!this.IsDisposed)
{
WindowState = FormWindowState.Maximized;
Show();
}
}
else if (State == FormWindowState.Minimized)
{
if (!this.IsDisposed)
{
WindowState = FormWindowState.Minimized;
Hide();
}
}
}
}
void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
this.Close();
this.Dispose();
}
void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
while (bContinue)
{
}
}
|
|
|
|
|
First off, do not repost a question when the other thread is still active and less than a month old. It just clutters up the forum more than necessary.
As for everything else, you may want to look into window manipulation through windows API. Their are a few commands that might be able to help you.
Regards,
Thomas Stockwell
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.
Visit my Blog
|
|
|
|
|
PrashantGadhave wrote: I am reposting this.
Don't do that. Just continue with the original thread.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I have added some more description to the original post. Could you please reply to that? It was posted yesterday with heading 'Popup shown in background worker thread'
regards
Prashant.
|
|
|
|