|
Usually as below if you want to check the result of a open file dialog you use the following code:
if (fDialog.ShowDialog() == DialogResult.OK)
{
MessageBox.Show("User clicked on OK / Open");
}
However this does not seem to work when developing a Windows Presentation Foundation based application, any suggestions ?
|
|
|
|
|
In WPF you cannot do that because it returns only Nullable<Boolean>.
So, a code like this should do the trick:
fDialog.ShowDialog();
if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
{
MessageBox.Show("User clicked on OK / Open");
}
|
|
|
|
|
file web.config makes the following settings for sending:
system.net
mailSettings
smtp
network
host="smtp.mail.ru"
port="25"
userName="username"
password="password"
smtp
mailSettings
system.net
Button "Send"
protected void send_Click(object sender, EventArgs e)
{
try
{
const string ToAddress = "mymail@mail.ru";
MailMessage mm = new MailMessage(UsersEmail.Text, ToAddress);
mm.Subject = Subject.Text;
mm.Body = Body.Text;
mm.IsBodyHtml = false;
SmtpClient smtpClient = new SmtpClient();
smtpClient.Send(mm);
}
catch (Exception exc)
{
L_message.Text = exc.Message.ToString();
}
}
Can not send email.
I use the internet via a proxy server.
Could the reason why this is not the mail is sent?
What can advise me in this situation?.
I tried different ways but not sent.
The exception, "Failed to send e-mail."
|
|
|
|
|
First, please format any code you post here properly. Read the guidance at the top of this forum.
The problem could be the proxy not allowing the traffic. You should look at the details of the exception, not just the message generated.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
how to send a message using a proxy?
|
|
|
|
|
Look at this Example
How to send an email in asp.net
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
modified on Saturday, August 7, 2010 5:00 AM
|
|
|
|
|
Since All the same, I send mail through a proxy.
|
|
|
|
|
Hi - I am trying to get my application to automatically select the item that was last added to my list box but am not sure how to get this done. My code so far is as below. Please bear in mind that I am using Windows Presentation Foundation.
private void btnLoad_Click(object sender, RoutedEventArgs e)
{
//Declare an instance of the open file dialog...
OpenFileDialog dlg = new OpenFileDialog();
dlg.ShowDialog();
string fileName = dlg.FileName;
lstBxList.Items.Add(fileName);
//Once the file has been loaded, select it...
????????
}
|
|
|
|
|
dlg.ShowDialog();
string fileName = dlg.FileName;
lstBxList.Items.Add(fileName);
lstBxList.SelectedIndex = lstBxList.Items.Count -1;
should do the trick.
V.
|
|
|
|
|
Try this
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.ShowDialog();
string fileName = dlg.FileName;
lstBxList.Items.Add(fileName);
lstBxList.SelectedIndex = -1;
lstBxList.SelectedIndex = lstBxList.Items.Count - 1;
}
|
|
|
|
|
how do i do then when i load a form it check the checkbox rather than showing true or false next to it
chkIsFavourite.text = gvdPizza.Rows.[e.Rowsindex].Cells[0].value.tosring()
|
|
|
|
|
Use chkIsFavourite.Checked = True ?
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
The only valid measurement of code quality: WTFs/minute.
|
|
|
|
|
How can i passing information from the datagrid to datagrid code i used
Collapse | Copy Code
clName.text = dgvSubs.Rows.[e.RowsIndex].Cells[0].Value.Tostring()
error says cannot covert system.windows.form.DatagridViewCell to system.windows.Form.DatagridColumnTextboxes
ClName- is the datagridViewtextboxes that in the datagrid that i want to pass the field to
|
|
|
|
|
Hi Peeps
I created a desktop App and published it with click once, I have a mdf with the published files and I am saving that mdf to a location on my c drive.
I tested the app on 2 different pc's and it works fine but on another pc I get an error, the pc where the error is on does not have SQL installed...
here is my error please help,
Error : a network-related or instance-specific error occured while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.(provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Thanks
|
|
|
|
|
You can't just access mdf file. You need to install MSSQL Server on the machine you're installing application or provide access to the server somewhere in the LAN/WAN.
Or if you don't use advanced SQL Server features you can try SQL Server Compact Edition (3.5 or 4.0). This is light version of the SQL Server. It has some limitations, but for some uses it is enough. It can be provided to the end user as 3 or 4 dll libraries.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
Thanks for the reply, I understand that but I'm using the prerequisites in the publish properties and I've selected SQL Server Compact 3.5 and SQL Server 2005 Express Edition, isnt that suppose to sort that out for me?
|
|
|
|
|
Aaaa. It should. You didn't mention it in first post Maybe firewall is blocking access to the server?
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
Sorry , but its not going to a server, let me explain in detail...
after you installed the app from the network you login on the program then a mdf is saved to that users's pc, so the program reads from that mdf file on that users's c drive
|
|
|
|
|
This is starting to be interesting
The error message you get looks as if the application tried to connect to SQL Server (not using express edition).
Maybe your app.config has some error (for example you don't set provider or something like this).
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
No beleive me everything is in there, appconfig etc.
This is one of those things I cant get my head around
here is my appconfig : <add name="ConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Folder\Databse\File.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
|
|
|
|
|
You're using SQL Server. ./SQLEXPRESS in DataSource indicates instance of SQL Server. Check the firewall settings and if the SQL service is up. And if the instance of the SQL Server on the machine is named SQLEXPRESS.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
1, caculate th EPF in basic salary,
2, reduction in the salary,
3, up to 75% working day count the per month bonus ruppess 90,
4, less to 75% working day count the per month bonus ruppess 90,
5, in form include the attentance
finaly calculate th enet salary..........
|
|
|
|
|
Ok, this is what you need, but what are you expecting here? Nobody will do the work for you!
|
|
|
|
|
Well, you have the basics of a design there. You need to flesh it out a bit.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
What have you tried so far?
|
|
|
|