|
i tried to remove the crystal report references in my web.config file and havn't had problems.(no error in compile time and file isn't recreating after deleting it).
So it mean Crystal Report is using this Log4Net ???
I installed "SAP Crisal Report, version for Windows".
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
Maybe... I don't know. But something you're referencing must be pulling in log4net, or it wouldn't be copying over.
Again, though... log4net generally works very well... Maybe you should try to track down the error instead of trying to wipe out the entire library.
|
|
|
|
|
Have you ever used Crystal Report in your Silverlight project.??
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
No, I use log4net in a C# windows service.
|
|
|
|
|
Hi Ian
and what do you this log4net use for ??? to Login ??
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
Go to the site I linked, and see for yourself... It's for writing log files.
|
|
|
|
|
Thanks Ian to help
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
jadughar wrote: So it mean Crystal Report is using this Log4Net ???
No. Something else might be though.
|
|
|
|
|
How have you obtained this Dll?
Silverlight may not support this version of the Dll.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Hi
I installed "SAP Crystal Report version for Visual Studio" .
In my web project when i tried to use Crystal Report to generate reports , and it generated this dll..
have yout ever tried to use Crystal Report in your web project ??
"For as long as men massacre animals, they will kill each other. Indeed, he who sows the seed of murder and pain cannot reap joy and love." Pythagoras
|
|
|
|
|
In a textbox of my wpf application, I would like to only allow numbers i.e.:
21 or 19.50 or 12.75 or 10
Can you see how my code below can be corrected because it only allows numbers such as 21, 1950, 1275, 10, etc... ?
Thank you
private bool IsDecimal(string text)
{
bool blnValidDecimal = false;
foreach (char c in text)
{
if (Char.IsNumber(c))
{
blnValidDecimal = true;
}
if (char.IsDigit(c))
{
blnValidDecimal = true;
}
}
return blnValidDecimal;
}
private void txtAvgGrade_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !IsDecimal(e.Text);
}
|
|
|
|
|
You might find decimal.TryParse useful.
decimal d;
return decimal.TryParse(text, out d);
|
|
|
|
|
Rather than attempting to reinvent the wheel, why not make use of the Attached Behavior I wrote here[^]? It gives you a lot of flexibility in how you accept your numbers, and manages features such as disallowing/allowing negative numbers, the number of decimal places allowed, whether or not the textbox accepts decimals or not.
|
|
|
|
|
thanks but I would like to get this existing code working.
Any thoughts on that please?
Thanks
|
|
|
|
|
Take a look at how I validate the input in that code. That's what you need to do. With your code, you are missing things like coping with the user pasting crap in. As long as they don't press a key, you have left your validation wide open.
|
|
|
|
|
|
Bloody net nazi won't let me in there, just you wait till I get home to a decent connection I'm gonna vacuum up all those behaviours I can find. I am only just getting a handle on how useful these things are.
I have a tremendous dislike for rewriting code and these fit very nicely with that idea.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: I am only just getting a handle on how useful these things are.
They really are useful. I love behaviors; so much so that we are supplying a lot of them to clients to cut down on the amount of boilerplate validation that needs to be performed.
|
|
|
|
|
In a textbox for the wpf application, how can I make sure the user enters a valid email address please?
I am using regular expressoion as follows but clicking away from the textbox still seems to be ok even if there is no proper email address in the textbox.
And I am not sure if regular expression is the right thing for this purpose.
Thanks
My existing code:
private static bool IsEmailAllowed(string text)
{
Regex regEMail = new Regex(@"^[a-zA-Z][\w\.-]{2,28}[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
return !regEMail.IsMatch(text);
}
private void txtEmail_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !IsEmailAllowed(e.Text);
}
This is what I used to do in windows but there is nothing similar to it in wpf
private void txtEmail_Validating(object sender, CancelEventArgs e)
{
System.Text.RegularExpressions.Regex rEMail = new System.Text.RegularExpressions.Regex(@"^[a-zA-Z][\w\.-]{2,28}[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
if (txtEmail.Text.Length > 0)
{
if (!rEMail.IsMatch(txtEmail.Text))
{
MessageBox.Show("E-Mail expected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
txtEmail.SelectAll();
e.Cancel = true;
}
}
}
|
|
|
|
|
If only somebody had written an attached behaviour to allow the user to prevent invalid values being typed in (or pasted in). Why, I think somebody might just have done that - wait, let me check.
By golly, it was me. You can find details here[^].
|
|
|
|
|
Thank you for the link...
However, I am trying to use the following method instead which is due to the requirements...
The problem is that I would like to call the IsEmailAllowed when I click away from the Email textbox.
As you see now, the call is in the txtEmail_PreviewTextInput and so, it returns false for each character I enter into the textbox.
Which event of the textbox can I place the code e.Handled = !IsEmailAllowed(e.Text); so it gets called after clicking away from the textbox.
Thanks
private static bool IsEmailAllowed(string text)
{
bool blnVallidEmail = false;
Regex regEMail = new Regex(@"^[a-zA-Z][\w\.-]{2,28}[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
if (text.Length > 0)
{
if (!regEMail.IsMatch(text))
{
MessageBox.Show("E-Mail expected", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
blnVallidEmail = !regEMail.IsMatch(text);
}
}
return blnVallidEmail;
}
private void txtEmail_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !IsEmailAllowed(e.Text);
}
|
|
|
|
|
You can try putting the call into the TextBox's LostFocus event, which fires when the TextBox loses focus(funny that).
Hope this helps
...and I have extensive experience writing computer code, including OIC, BTW, BRB, IMHO, LMAO, ROFL, TTYL.....
|
|
|
|
|
|
arkiboys wrote: However, I am trying to use the following method instead which is due to the
requirements...
What requirements do you have that say you have to provide your own preview check input? What you are trying to do here is actually poor form - if the user types in that doesn't match the regular expression you throw a message box up - it's better to prevent them from putting in an invalid value than telling them they got it wrong. BTW, you are using the preview key event here and then extracting the value from the textbox. In other words, if the user types in all valid characters bar the last one, your code won't catch it because it is reacting to the values that are already in the textbox, which does not include the key you've just pressed.
If what you are trying to do is just validate the input, then you need to implement IDataErrorInfo on your ViewModel, and then add the following to your binding in the textbox:
UpdateSourceTrigger=LostFocus, ValidatesOnDataErrors=true, NotifyOnValidationError=true By handling LostFocus, the validation will only occur when you focus away from the textbox. To add the validation in, you need to add the following code:
public string Error
{
get { throw new NotImplementedException(); }
}
public string this[string columnName]
{
get
{
string result = null;
if (columnName == "Email")
{
Regex regEMail = new Regex(@"^[a-zA-Z][\w\.-]{2,28}[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
bool isValid = regEmail.IsMatch(Email);
if (!isValid)
{
result="You must enter an email";
}
}
return result;
}
}
|
|
|
|
|