|
IF you mean
DataAcces datc=new DataAcces();
then you need to step into the code, something in the constructor for your class is failing. If this is a data tier, the methods should probably be static, so you don't need to create one every time.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Well, I'd really be thankful to you if you can help me out.
I'm working the Regions which are made up of GraphicsPath objects.
(GraphicPath objects are created with a set of Points).
After creating Regions, I do the complement for two regions.
Now, I want to get the points from the regions.
|
|
|
|
|
Why don't you keep the GraphicsPath objects after creating the Regions from them?
AFAIK you can only get all pixels in the regions:
public void GetPixels()
{
ArrayList pixels = new ArrayList();
for (int y = 0; y < imageSize.Height; y++)
{
for (int x = 0; x < imageSize.Width; x++)
{
if (region.IsVisible(x, y))
{
pixels.Add(new Point(x,y));
}
}
}
}
This article[^] contains a lot of examples about Regions and GraphicPaths, maybe it can help you a little.
|
|
|
|
|
That would be quit slow and inefficient. There are efficient clipping algorithms (e.g. Cohen-Sutherland) which can be used to know every point in the new region.
To put every pixel in an ArrayList is the worst to be done, sorry but this is super slow...
Regards,
Ingo
------------------------------
PROST Roleplaying Game
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
Thank you Ihoecken !
I'll go through that algorithm.
I need the vertices/points of the polygon.
|
|
|
|
|
Thank you Corrina for your reply.
I'm using the GraphicsPath before regions because I'm creating polygons.
i.e polygons added to Graphicspath and then regions are created using the paths.
After that I'm complementing both the polygons and then I need the vertices/Points of the complemented polygons.
Pixels won't help me, could you please suggest something else.
Secondly, Could you please tell me what the RegionData().Data is all about?
|
|
|
|
|
hi guys !
need some help..
i want to match whole words in my string using regular expression
i m using Regex.IsMatch function for this and using "\b" as start and end tags for matching the word as a whole
every thing is working fine but
if some special character comes with the words like '***SPAM***' it throws an exception
"Argument Exception , nested quantifier?"
can any one help me how to deal with this as i also want these special characters to be matched.
moreover there could be any special character which could occur n numver of times in the word.
how to deal with that.
abhinav
|
|
|
|
|
Use the Regex.Escape method to escape the characters in the string, so that you can use it in the regular expression.
---
b { font-weight: normal; }
|
|
|
|
|
thanx for the reply guffa
but can u explain it with a small example if possible.
thanx again
abhinav
|
|
|
|
|
A possibly easier solution would be to write the string (if hard-coded in the code) as:
string regex = @"regex-goes-here";
The @ symbol tells csc not to escape the C# characters like '\n', '\t' etc.
(The Regex class can do this anyway when passed a literal string.)
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
Example:
string word = @"c:\dir\body.txt";
string pattern = @"\b" + Regex.Escape(word) + @"\b";
Regex re = new Regex(pattern);
---
b { font-weight: normal; }
|
|
|
|
|
Hi!
thanks again for the reply guys.
i tried the Regex.Escape method.
it works good and don't throw any exception but it do not match the whole word also.
m i again missing some thing..
here is my code:
<code>public bool sSearchWholeWord()
{
string sSearchWord="***SPAM***";
string content="hi this is ***SPAM*** testing";
string pattern = @"\b" + Regex.Escape(sSearchWord) + @"\b";
Regex re =new Regex(pattern,RegexOptions.IgnorePatternWhitespace);
try
{
if(re.IsMatch(content))
{
return true;
}
else
{
return false;
}
}
catch(Exception e)
{
Response.Write(e.ToString());
return false;
}
}</code>
this returns false but according to me it should return true
i dont know what m i missing
abhinav
|
|
|
|
|
I have an application that runs using Schedule task every morning. I want to create a coding that will send an email to the user after the application runs in the morning.
Please help.
boboza
|
|
|
|
|
System.Net.Mail namespace if you're using Framework 2.0
System.Web.Mail namespace if you're using a prior Framework version
"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
|
|
|
|
|
Hello,
This is so stupid and yet I can't find the solution:
On my winform I have two comboboxes that have exactly the same DataSource, displaymember and valuemember.
Now I execute the same sql-statement twice and bind the dataset to the datasource, which works perfectly. Because of the amount of data to be loaded (on the entire form) it takes a bit long to show the form and that's why I need to speed it up.
Here's where my problem starts. I've tried to set the datasource of 1 combo = to the other one. Apparently he copies the address so both datasources point to the same Dataset. If you change one combo in your form, the other one gets the same value.
What I actually need is that the DataSet (or DataSource) value is copied, not the address.
tnx for your help...
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
GEt your datasource, use the Clone() method to make a copy, then assign one to each.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks, but I'm still doing something wrong ??
This is my code, but my combo's are empty.
<br />
combo_state.DataSource = dbc.GetDataSet().Clone().Tables[0].DefaultView;<br />
combo_nationality.DataSource = dbc.GetDataSet().Clone().Tables[0].DefaultView;<br />
combo_state.ValueMember = "country_id";<br />
combo_state.DisplayMember = "lbl";<br />
combo_nationality.ValueMember = "country_id";<br />
combo_nationality.DisplayMember = "lbl";<br />
thanks again.
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
hi,
take Clone() operation first in your code.
DataSet _ds=dbc.GetDataSet().Clone();
then assign it to combo source.
combo_state.DataSource=_ds.Tables[0].DefaultView;
|
|
|
|
|
this:
DataSet _ds=dbc.GetDataSet().Clone();<br />
combo_state.DataSource=_ds.Tables[0].DefaultView;<br />
equals:
combo_state.DataSource = dbc.GetDataSet().Clone().Tables[0].DefaultView;
I think, no?
But I found the problem. Clone() only copies the structure. no data. You have to use the Copy() method to copy the data and the structure.
like this:
<br />
combo_state.DataSource = ((DataView)combo_nationality.DataSource).Table.Copy().DefaultView;<br />
combo_state.DisplayMember = "lbl";<br />
combo_state.ValueMember = "country_id";<br />
tnx for the help.
I've found a living worth working for, but I haven't found work worth living for.
<marquee>
|
|
|
|
|
yes. your answer is right
|
|
|
|
|
|
Hello!
I have a problem, I'm trying to read an XML-file that may contain characters from different languages, like for example swedish, danish or german non-ascii characters.
when i load the reader into my xmlDoc, i get an exception telling me that one of the caracters is invalid.
is there any setting i can do to make the xmlreader ignore what kind of caracters the element includes?
Can i have something to do with the header (i have xml-files with no header)
example xml:
<rootNode>
<firstChild>
<grandChild>normal</grandChild>
</firstChild>
<secondChild>
<grandChild>äää-not-normal</grandChild>
</secondChild>
<rootNode>
kind regards
Andreas
-- modified at 2:52 Friday 4th August, 2006
|
|
|
|
|
Specify the encoding when you create the streamreader. Example:
StreamReader reader = new StreamReader(fileName, Encoding.GetEncoding("windows-1250"));
---
b { font-weight: normal; }
|
|
|
|
|
I recommend fixing the XML document instead of trying to make your program read invalid XML.
See for example here[^]
The default encoding is UTF-8, if you use anything else you must
a) Specify it in the header
b) Kill yourself to save the world from yet more ANSI junk. Only exception is if you use another Unicode encoding (UTF-16 for example), but normally this is not needed.
|
|
|
|
|
First of all, what is your code, what reader are you using? An xml reader, DOM, SAX, or a text reader?
No doc type (header)?? That's actually not valid XML. Is it possible to include it? Short of a Byte order mark, w/o the doc type there is NO way to accurately figure out the encoding of file.
If you can't add the doc type to your XML doc, you must specify the encoding in your code. UTF-8 would be a safe guess.
-- modified at 3:03 Sunday 6th August, 2006
-- modified at 3:04 Sunday 6th August, 2006
/\ |_ E X E GG
|
|
|
|