|
Ok thanks for the reply, I'll trying that now.
*EDIT* I posted the exception but it got deleted I think. I changed the catch to:
Response.Redirect("success.html");
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
I had to FTP the site before the exception would show. It kept going to success.html when I tested with Localhost. I didn't receive any email after I FTP'ed either.
Respect,
(*$malli$*)modified on Thursday, February 18, 2010 10:08 PM
|
|
|
|
|
Ok I changed the Catch to this:
Response.Redirect("success.html");
}
catch(Exception ex)
{
Label1.Text = "ex message: " + ex.Message;
}
After I changed it, it redirected to "success.html" and I still got the email, so I decided to FTP it to see if it really was "successful".... It wasnt, and my ex message was: Failure sending mail.
No email and no details at all :/.
Thanks again for the reply.
Respct,
(*$malli$*)
|
|
|
|
|
Have a look at the ex.Innerexception , it may contain a clue as to why it failed if it has a value.
|
|
|
|
|
Where do I place ex.Innerexception please?
Respect,
(*$malli$*)
|
|
|
|
|
put a breakpoint in your catch block and when it's hit, hover your mouse over the ex
You will now be able to examine all the exception's properties including the InnerException[^] property.
|
|
|
|
|
Ok thanks for the help, I got to view it at last...
Now the fact that I get the email when testing through Localhost but not when I FTP the website, does that mean that something is wrong with my SMTP details? here is the top half of the InnerException:
System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 188.121.53.3:25 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress
would that IP address maybe be blocked by GoDaddy or something?
Respect,
(*$malli$*)
|
|
|
|
|
hello
I want to know how I could solve this problem. child forms goes behind panel in the parent form .and I just could change background color I want to place a picture on the background how could I do this?
|
|
|
|
|
MDI - set background picture here[^].Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
thank you a lot. but how about panel ? when I add a panel to the parent form,child form goes behind panel.
|
|
|
|
|
There is a property called BringToFront() .
Try using this property on your child control.Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
I tested it but it didn't work.
|
|
|
|
|
I ran into this issue myself, you have to dock your panel to get the behavior you want.
|
|
|
|
|
how? I already start to learn c# and I don't know what you mean.
|
|
|
|
|
My apologies for the relatively newbie-ish question -- I'm rather new to C# and WPF programming. Here's an object I'm trying to use with strong influence from Pro WPF in C# 2008 (.NET version 3.5) that's supposed to validate a text box's contents:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
namespace LeanQualityTool
{
public class ValidatedTextBox : TextBox, INotifyPropertyChanged, IDataErrorInfo
{
private string _TextContents = "";
public string TextContents
{
get { return _TextContents; }
set { _TextContents = value;
NotifyPropertyChanged("TextContents");
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(string info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
#region IDataErrorInfo Members
public string Error
{
get { return null; }
}
public string this[string fieldName]
{
get
{
string result = null;
#region For Validating Text
if (fieldName.Contains("Title"))
{
if (this._TextContents.Length == 0)
{
result = "Text should not be blank";
throw new ArgumentException(result);
}
else
{
}
}
#endregion
return result;
}
#endregion
}
}
}
And here's the relevant XAML:
xmlns:vip="clr-namespace:LeanQualityTool"
<vip:ValidatedTextBox Height="23" x:Name="txtJobTitle" HorizontalAlignment="Left" Width="276"
Style="{StaticResource validatedTextBox}">
<TextBox.Text>
<Binding Path="SelectedItem.Title" UpdateSourceTrigger="PropertyChanged"
ValidatesOnDataErrors="True">
</Binding>
</TextBox.Text>
</vip:ValidatedTextBox>
I try to put a breakpoint on the IF statement in the class, but when I debug the app, changing the text in the textbox doesn't even cause the breakpoint to engage. Why isn't the new ValidatedTextBox working?
|
|
|
|
|
Try posting this in the WPF forum. You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
|
Did you really get this code from book? I really need to write a book.
BTW, you are binding to the Text property of the TextField. In code and not automagic binding, what kind of happens is this:
public class TextBox{
public string this[string fieldName]{
get;
set;
}
}
TextBox foo = new TextBox();
foo.Text = "Some Value";
So the Text Property is getting fired. Your codes seems to be:
public class TextBox{
public string Text{
get{...}
set{...}
}
}
TextBox foo = new TextBox();
foo["test"] = "test";
What I think the Author meant was, register the Notify Property event changed from the parent Text Box then call your validate method which should be a method and not an indexor like:
public class TextBox : System.Windows.Forms.TextBox {
protected override void OnTextChanged(EventArgs e) {
base.OnTextChanged(e);
Validate();
}
public void Validate() {
}
}
Of course I am just guessing.
|
|
|
|
|
Worked like a charm!
Let me know if and when you get that book written, okay? I'll buy three copies.
|
|
|
|
|
I have an application which a tabcontrol on it. Each tab has various input boxes of various types (textboxes, gridviews, checkboxes and comboboxes). When the user clicks a tab the applicable data is loaded from a database and the controls on that tab are populated. When the user clicks a different tab, a messagebox should pop up asking if he wants to save his input. That part is not a problem. However, I would only like the box to pop up if he changed any input, or at least clicked inside a control. Is there a global way to sense this? I thought about creating a boolean flag, that gets set in each control change event - however this would seem bulky.
Thanks
Marc
|
|
|
|
|
If you already have a class that holds the data for each page, then you can take a copy of the original data and then compare it to the possibly edited data.
It's a bit of work to implement a copy constructor and equality operator, but it does have the advantage that if a user changes something and then changes it back, then he won't be prompted to save.
Nick----------------------------------
Be excellent to each other
|
|
|
|
|
What do you mean a class that holds the data? I guess I could put the data in a dataadapter object, and then load the data into a second dataadapter object upon tab click and compare the two objects. Not sure if you can compare them directly though.
Thanks
Marc
|
|
|
|
|
mbangh wrote: What do you mean a class that holds the data?
The states of your controls, for example the Text property of a TextBox control, represent data. You must be storing this data somewhere. You normally store it in an instance of a class, for example an instance of a Person class that has string properties that hold a particular person's first and last names.
When you load a form, you normally take data from your object and set the states of your controls. The user then has the opportunity to alter the controls. Then you put the new data back into your object to persist it.
If this is the case, then I was suggesting comparing the before and after objects instead of trying to detect when a user manipulates any control.
Nick----------------------------------
Be excellent to each other
|
|
|
|
|
Add a notify property changed event to the underlying data object. Register the event listener on the DataAdapter. If the event gets fired, show your message box. Otherwise, don't.
|
|
|
|
|
Hi there
I can't get Exchange webservice for Exchange 2007 SP1 working
http://msdn.microsoft.com/en-us/library/bb408417%28EXCHG.80%29.aspx[^]
when I run the following C# code:
ExchangeService service = new ExchangeService();
service.Credentials = new WebCredentials(@"username", "password", "domain");
service.AutodiscoverUrl("username@domain.co.za");
FindItemsResults<Item> findResults =
service.FindItems(WellKnownFolderName.Inbox,new ItemView(10));
foreach (Item item in findResults.Items)
{
}
It get this error:
Request failed. The remote server returned an error: (401) Unauthorized.
Any help will be greatly appreciate !!
Thanks in advance.
|
|
|
|
|
hello, can anyone help me with this?
|
|
|
|