|
How could i validate a unicode string
Thanks
|
|
|
|
|
|
Good find.
"
Validating Unicode Characters
Use the following code to validate Unicode characters in a page.
using System.Text.RegularExpressions;
. . .
public class WebForm1 : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
// Name must contain between 1 and 40 alphanumeric characters
// and (optionally) special characters such as apostrophes
// for names such as O'Dell
if (!Regex.IsMatch(Request.Form["name"],
@"^[\p{L}\p{Zs}\p{Lu}\p{Ll}\']{1,40}$"))
throw new ArgumentException("Invalid name parameter");
// Use individual regular expressions to validate other parameters
. . .
}
}
The following explains the regular expression shown in the preceding code:
^ means start looking at this position.
\p{ ..} matches any character in the named character class specified by {..}.
{L} performs a left-to-right match.
{Lu} performs a match of uppercase.
{Ll} performs a match of lowercase.
{Zs} matches separator and space.
'matches apostrophe.
{1,40} specifies the number of characters: no less than 1 and no more than 40.
$ means stop looking at this position.
"
/\ |_ E X E GG
|
|
|
|
|
Hi all,
can someone post a snippet of code that draws a rectangle of 2x3 inches ? I mean something that on
every Graphics (and then with every sort of dpi) is 2x3 inches.
I'm getting mad whit this....
please help !
thanks.
|
|
|
|
|
I don't see how that would even be possible. To do it, in addition to knowing the size and type of a monitor to get the approximate screen size (ie 17" crt is about 16" usable), you'd need to know the exact position they adjusted the hieght and width controls to. Beyond that, if you did do this you'd create something that was completely unusable for anyone who, for bragging rights or due to poor vision, is using a projection screen as a primary display.
|
|
|
|
|
I don't see why not.
Infact, I've found how to do it:
g.PageUnit = GraphicsUnit.Millimeter;<br />
g.DrawRectangle(Pens.Black, 50, 50, 50, 50);
does exactly what I need: without care of dpi draws in inches/millimeters/whatever.
|
|
|
|
|
I am using Microsoft's Message Queue and want to get the ID of the Message I just placed in the Q. Reading a few of the examples I have found it says you can do a simple:
mq.Send(msg, Ticket);
string id = mq.Id.ToString();
All this does is return me a Guid with all zero's in it.
I open up Message Q and see my package there. The 'Label' on the Package is all zero's, however, the ID is an actual Guid.
I have tried 'Label' instead of 'Id' and still nothing.
I really need to get that ID of that package I just inserted into Q for processing.
Any help would be appreciated.
Steve Welborn
Software Architect
|
|
|
|
|
|
DOH!
Your right, worked great. Thanks leppie!
Steve Welborn
Software Architect
|
|
|
|
|
I made this with xacc ide...
apparently it didn't make it to the clip board. It was really cooL!
/\ |_ E X E GG
|
|
|
|
|
Hello,
I have a string to display in my text box:
this.textBoxAssumedHC.Text = (Convert.ToDecimal(myStr)).ToString("c0");
But on leave event I want to convert it back to decimal value, and because there is a dollar sign in front (provided by "c0") it gives me an error.
Any ideas, because I don't want to use the split function.
Thank you
|
|
|
|
|
If you just need to drop the '$', why don't you just use substring to get a substring containing all the chars except the '$', and then conver that?
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
We are creating a windows desktop application and are wondering if there is a disadvantage performance-wise in using User Controls versus embedding the code into the main form.
Thank you for any feedback you can give,
Anne
|
|
|
|
|
no performance problem especially if you dont have many controls in many DLLs
in another side using user controls have advantage like
Usability and maintainability
MCAD
|
|
|
|
|
I have a nice table that I create and show in a datagrid. The data loads perfectly, and then displays nicely. But I need to do some things with it. For starters, I want to add another column that is for display only. So I've tried to add the column "Date" as shown, but it never shows up in the datagrid.
I also want to be able to set the Date column, which I thought would entail cycling through the rows. However when I try to cycle through the rows (in the foreach statement) nothing happens. The MessageBox.Show never pops up.
Any idea why my new column won't show up and why I can't cycle through the rows of my table?
If there's an easier way to just add a column and dynamically change the entries for each row, let me know. And if there's a way to keep data in the data set/data table and NOT show it in the datagrid, I'd like to know that too (I don't want my primary and foreign keys showing up at all but i need to keep track of them).
Thanks!
strClaimsSQL = this.GetClaimsSQL();
da = new OleDbDataAdapter(strClaimsSQL, strConn);
ds = new DataSet();
ClaimsTable = new DataTable();
da.Fill(ds, "ClaimsTable");
DataColumn claimDates = ClaimsTable.Columns.Add("Date");
claimDates.ColumnName = "Date";
this.dgrClaimsData.DataSource = ds;
this.dgrClaimsData.DataMember = "ClaimsTable";
foreach (DataRow row in ClaimsTable.Rows)
{
MessageBox.Show("This is a row in the Claims Table.", "Testing Output");
int i = 0;
row["Date"] = i.ToString();
i++;
row["Premiums"] = i.ToString();
}
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
The columns Didnt displayed and you can not loop throgh
The Rows because the tables was empty look with me
theStorminMormon wrote:
da.Fill(ds, "ClaimsTable");
Now you filled the DataSet with Data from your table
This why all other Columns displayed in the grid
theStorminMormon wrote:
ClaimsTable = new DataTable();</ i>
Now you Create New DataTable which have not any relation with ds DataSet
So Remove it and write
DataColumn claimDates = sd.Tables["ClaimsTable"].Columns.Add("Date");
claimDates.ColumnName = "Date";
To loop for each row
foreach (DataRow dr in ds.tables["ClaimsTable"]
.Rows)
{
}
I hope this help
MCAD
|
|
|
|
|
I guess I was writing my own reply at the same time that you were writing this one. I just wanted to say thanks for your response. It's kind of you to help out, even though in this case I had figured it out too (usually I don't figure it out on my own).
Thanks!
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
Is there any wya to add the "Dates" column so that it will be the first column in the data grid?
Thanks!
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|
|
If you want to display Date Column at firs Add it First Before You Fill The DataTable a modification of previous code that will display Date column at first will be as following
DataTable table=new DataTable("Customer");
DataColumn dc=new DataColumn("Data");
table.Columns.Add(dc);
sqlDataAdapter1.Fill(table);
dataGrid1.DataSource=table;
MCAD
|
|
|
|
|
Could you please stop using that background image. It makes reading your posts all but impossible.
|
|
|
|
|
What background image you are taking about?
are you mean
This Not background image it is pre tag
MCAD
|
|
|
|
|
Yes that's exactly what I'm refering to. I don't know what you want it to do, but in both firefox and ID it's streching the length of the screen and making the text behind unreadable without highlighting with the mouse.
|
|
|
|
|
Sorry for annoying you
but nothing from what you mentioned appear in my screen
So i use it to highlight the code and its displayed whith out problem
MCAD
|
|
|
|
|
What's it look like in your browser, in FF1.06 and IE6 the area is tiled with a letter image.
Anyone else seeing the same?
|
|
|
|
|
I'll answer my own question now that I figured it out. Just in case anyone else ever wants to know...
Right, so the problem was thinking that the table I created on this line:
ClaimsTable = new DataTable();
was the same as the table created by the data adapter fill method:
da.Fill(ds, "ClaimsTable");
But the two are not the same. To access the table with my data I need something like da.tables[0]... So when I ran the foreach (DataRow row in ClaimsTables.Rows) I was accessing a table that had been created, but that had no rows.
So essentially I had two tables with identical names, but one held data and one did not and I needed to learn how to access the one that DID hold data.
Yay for learning experiences.
The ends can never justify the means. It is the means that determine the ends.
|
|
|
|