|
Are there any simple examples of this? I would like to do this, but never used C++. I would love to see a simple app that gets its labels and text stuff from a resource...
rod
|
|
|
|
|
Hi!
I have the following question. Is there any way to know if an event (i.e. the click of a button) has an EventHandler associated? I need to know which event have eventhandlers and which do not.
Thanks,
Matias
|
|
|
|
|
<font color=blue>if</font>(<code>button1</code>.click!=null){
<font color=green>
}
<font color=blue>else</font>{
<font color=green>
}
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
I'm using an XML file to store user preferences, but I can't decide on what's the best format. The data would easily been stored in an INI file using sections, keys, and values, but I want to use XML instead. I'm come up with a couple of alternatives:
1.
<?xml version="1.0" encoding="utf-8"?>
<profile>
<section name="Some Section">
<key name="Some Key">Some Value</key>
<key name="Some Other Key">Another Value</key>
</section>
<section name="Some Other Section">
...
</section>
</profile>
2.
<?xml version="1.0" encoding="utf-8"?>
<profile>
<Some_Section>
<Some_Key>Some Value</Some_Key>
<Some_Other_Key>Another Value</Some_Other_Key>
</Some_Section>
<Some_Other_Section>
...
</Some_Other_Section>
</profile>
Which of these two would you choose and why? If you know of a better alternative, I'd love to hear it.
Thanks!
Alvaro
PS. I've already posted this in the XML forum, but since the code will be written in C# I thought I'd try it here too.
|
|
|
|
|
The first. The document structure isn't affeted by the data that you are storing. This will make a _big_ difference when checking your XML for validity against a schema. The second version would require a schema for every .ini file. This would make a.ini a different type from b.ini, assuming they had different keys.
Unless this is the behaviour you want..
HTH
Ryan
|
|
|
|
|
I agree totally. It's like if a collection class had a different member for each key/value pair it had stored in it rather than an indexer that accessed the values via the key.
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|
|
Alvaro Mendez wrote:
The data would easily been stored in an INI file using sections, keys, and values, but I want to use XML instead.
Just another thought Alvaro, but you can still use XML with sections, keys and values. Take a look at my article : An extension for a Configuration Settings class in .NET[^]. Below would just be a sample layout you could use. Just my two cents worth.
<configuration>
<configSections>
<section name="ApplicationData" type="Support.ConfigSettingsSectionHandler, Support" />
</configSections>
<ApplicationData>
<add key="Height" value="618" />
<add key="Width" value="968" />
<add key="Top" value="116" />
<add key="Left" value="138" />
</ApplicationData>
</configuration>
-Nick Parker
DeveloperNotes.com
|
|
|
|
|
Is there a way to do this? I tried setting the PasswordChar of the textbox contained in my datagrid, but that only masks the text when that textbox is selected. If you click away from the textbox the masked text is revealed again. I'm binding to an array of MyClass objects contained within another object.
Here's my code:
<br />
dgServers.SetDataBinding(myClassCollection,"MyArray");<br />
DataGridTableStyle myTS = new DataGridTableStyle();<br />
myTS.MappingName = "MyClass[]";<br />
DataGridTextBoxColumn myCS = new DataGridTextBoxColumn();<br />
myCS.MappingName = "Password";<br />
myCS.Width = 500;<br />
myCS.TextBox.Multiline = false;<br />
myCS.TextBox.PasswordChar = '*';<br />
myTS.GridColumnStyles.Add(myCS);<br />
dgServers.TableStyles.Add(myTS);<br />
What do I need to override to get this to work?
Thanks
|
|
|
|
|
Okay, I worked this out with a little help from somewhere else. What you need to do is create a new class that derives from DataGridTextBoxColumn and override the Paint method. Here's what I did in case anybody else needs to do this:
public class PWColumn : DataGridTextBoxColumn
{
protected override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight)
{
MyClass thisObj = (MyClass) source.Current;
string orig = thisObj.Password;
orig = Regex.Replace(orig,".","*");
this.PaintText(g,bounds,orig,alignToRight);
}
}
|
|
|
|
|
can any dll written and compiled in vb.net, c++.net, or j#.net be used unconditionally in a c# project?
|
|
|
|
|
|
Hi all,
I have to detag an HTML page. So I used the pattern
string pattern = @"(?i)<script([^>])*>(\w|\W)*])*>|(?<gt>(<(""[^""]""|'[^']'|[^>])+)?>)";
string strParsed = Regex.Replace(contenuHtml, pattern, " ");
with this I got text with some malicious code like ".maillink{color:white;text-decoration:none;}" and so on.
For exple having HHHHfunction(){ffff}je suis néo en C#jksfjksdfjkfkfj I would like to obtain the contain of the body "je suis néo en C#jksfjksdfjkfkfj" and trashing all scripts, css, links and so on.
Some one can help me giving to me the correct pattern for the Regex.Replace(....)?
Thanx very much
TT
|
|
|
|
|
I may be a little confused by why not just do something like this
int nStart = contenuHtml.IndexOf("");
int nEnd = contenuHtml.IndexOf("");
string strBody = contenuHtml.SubString(nStart+5, nEnd);
|
|
|
|
|
With this solution I cannot clean malicious code like tags options, some cascade style sheet options. Fro exple:
nnnnnnn
I would try to integrate your solution in my code and I hope it should run.
Thanx
|
|
|
|
|
What's the difference between:
1. "RequestOptional" and "PermitOnly"
2. "Demand" and "RequestMinimum"
|
|
|
|
|
how can i pass a parameter to a thread??
Thread thread = new Thread(new ThreadStart(threadFeed(feed)));
you see; I need to send the array "feed" to the method "threadFeed", but I it won't allow me.
I asked a friend and he said you couldn't pass parameters to threads...
If you can't pass parameters, how is the thread sopposed to get any outside information????
/\ |_ E X E GG
|
|
|
|
|
I know... that can be a pain. Put it in a variable that's reachable from the threadFeed method, and have the threadFeed method read it from there.
|
|
|
|
|
wow i posted that about 10 seconds ago...
damn... and I was really psyched about multi threading too. This sucks...
/\ |_ E X E GG
|
|
|
|
|
You do know that only the starting method is the only
one that can not take parameters.
|
|
|
|
|
i know... but that's the only one I care about... ideas?
/\ |_ E X E GG
|
|
|
|
|
|
Create a class to hold your parameters and that class has the method you want the new thread to start running & pass the instance method as the constructor parm to your thread.
ex:
class MyThreadWorker
{
public string MyParm;
public void MyMethod(void)
{
// Do stuff w/ MyParm
}
}
...
MyThreadWorker w = new MyThreadWorker()
w.MyParm = "WooHoo";
Thread thread = new Thread(new ThreadStart(w.MyMethod));
...
|
|
|
|
|
Thanks for you help.....
uh... it wasn't working for a while, until I realized there was no thread.Start()....
anyways, it works now. thanks.
/\ |_ E X E GG
|
|
|
|
|
|
Got a project on hand, but they need to implement to the Win32 DLL in order
for the call from the framework. Is it possible or means that I have to
switch to VC++. Nightmire if have to do that.
|
|
|
|