|
excellent answers are here[^].
Why do you repost? It will not help you, continue the existing thread if you have to.
|
|
|
|
|
Hello everyone,
I am writing the following program to send a message to my gmail box. There is no
exception, but I can not receive any email in my gmail inbox. Does anyone have any ideas
why?
MailMessage mailMsg = new MailMessage();
mailMsg.From = new MailAddress("youremail@example.com");
mailMsg.To.Add("someone@example.com");
mailMsg.Subject = "Test subject 2";
mailMsg.IsBodyHtml = true;
mailMsg.BodyEncoding = Encoding.UTF8;
mailMsg.Body = "This email is sent from asp.net code";
mailMsg.Priority = MailPriority.Normal;
SmtpClient client = new SmtpClient();
client.Credentials = new NetworkCredential("myemailaccount@gmail.com",
"mypassword");
client.Port = 587;
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
object userState = mailMsg;
try
{
client.Send(mailMsg);
}
catch (SmtpException ex)
{
Console.WriteLine(ex.ToString());
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
return;
thanks in advance,
George
|
|
|
|
|
|
Cool, thanks Tamer!
Looks the site is not free?
regards,
George
|
|
|
|
|
how to insert unicode into wordpad using c# app working in background?
while typing text in wordpad and would like to insert a "circumflex".
example: when type a letter "A" in wordpad and would like to add a "circumflex onto "A" from c# app that working in background.
|
|
|
|
|
Why do you need unicode to send 'circumflex'?
You need the window handle of the texbox inside the instance of notepad that is running, then you can send it window messages. AKA, an ugly hack.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I have a gridview with users list. When I double click a row it opens a new tab with a new gridview, fetching data that does belong to that user from another table. Question is, how can I and create a connected database gridview with this selected data? I always done data task my way, using access layers and sprocs and I'd like to start learning connected/binded data operations.
Tables are like this:
Users UserRecords
--------- ------------
ID RecordId | UserId
The second gridview should be binded to rows from UserRecords with like UserId=1234...
I'd appreciate any info on this..
|
|
|
|
|
Hi i am back here with another problem that i am facing with C#. I am still a newbie to this language and i am having a problem with my current project.
Below is a screenshot of what my project looks like at current in VS2008:
What i need is to have the column headers dynamically change depending on what option the user will select to view (client, job, contractor etc) because at current the only way i can name the column headers is by manually naming them...
This would work for the first option (client) but when the user would click on say the (job) button to view jobs in the list it will still show the column header for (client).
I have looked over the internet and in my books and the only method they show for naming column headers is by using the gui way in vs2008.
Would a way to get around this be to have a listview class for each of the nav buttons i have (client, job, contractor etc) so when a user clicks, it calls a seperate listview (so there is actually 8 list views storred but only 1 called when a button is clicked?)
Thank you in advance.
c~Rose
modified on Friday, December 26, 2008 11:48 AM
|
|
|
|
|
cobalt-rose wrote: hat i need is to have the column headers dynamically change
You can first clear the listview from data and then remove oclumns. After that add the new columns you need. In order to do this, have a look at: ListView.Columns Property[^].
cobalt-rose wrote: Would a way to get around this be to have a listview class for each of the nav buttons i have
That's one way, but I think you're wasting resources if you have several listviews and you actually need only one at a time.
|
|
|
|
|
First create your columns (e.g. using VS GUI, but actually you can do it in code), then change the column header text like this:
listView1.Columns[0].Text = "Some header";
Regards,
Lev
|
|
|
|
|
Thanks for the advice...
I have managed to get my column headers displaying from using an array. But the problem that i now face is that when i click on my "clients" button in my app the data is pulled out but it is only displaying in the first column [see image link]
could you provide me with some tips?
My code:
private void client_buttonBox_Click(object sender, EventArgs e)
{
string[] colhead = { "Client_ID", "Company_Name", "Contact_Name", "Employee_Count" };
int p;
dataCategory = client;
// Create a ColumnHeader object
for (p = 0; p < colhead.Length; p++)
{
ColumnHeader header = new ColumnHeader();
// Set its text to be displayed
header.Text = (colhead[p]);
// Add it to the listview through its columns collection
listView1.Columns.Add(header);
}
string connectionString = "Data Source=localhost" + "; Database=deroche_consultants" + "; User ID=root" + "; Password=password;";
MySqlConnection MySqlConn = new MySqlConnection(connectionString);
string strSQL = ("SELECT company_id, contact_name, company_name, employee_count FROM client");
MySqlCommand mysqlCommand = new MySqlCommand(strSQL, MySqlConn);
MySqlDataReader Reader;
MySqlConn.Open();
Reader = mysqlCommand.ExecuteReader();
while (Reader.Read())
{
string thisrow = "";
for (int i= 0;i<reader.fieldcount;i++)>
thisrow+=Reader.GetValue(i).ToString() + ",";
listView1.Items.Add(thisrow);
}
MySqlConn.Close();
}
http://img.photobucket.com/albums/v678/cozboz/samecolumn.png[^]
[IMG]http://img.photobucket.com/albums/v678/cozboz/samecolumn.png[/IMG]
|
|
|
|
|
The first question is the listview empty when the user clicks the Clients button?
You should, probably, first clear the listview items and columns, then add new columns for the data you are loading.
In the data load code you are iterating through the rows and pushing all the columns of the reader into the first column of the listview.
Here is an example of populating a listview with several columns and data.
listView1.View = View.Details;
ColumnHeader col1 = new ColumnHeader();
col1.Text = "col1";
listView1.Columns.Add(col1);
ColumnHeader col2 = new ColumnHeader();
col2.Text = "col2";
listView1.Columns.Add(col2);
ListViewItem item = listView1.Items.Add("Hello");
item.SubItems.Add("world");
I'm sure you'll figure out the rest by yourself.
BTW, check out this link[^]
Regards,
Lev
|
|
|
|
|
Hey i have been advised to use a datagrid and have now managed to get the data displaying which im very happy with. Two questions though, is there a way to change the appearance of the datagrid as it looks pretty ugly compared to the listview also i am trying to get all data to display on a seperate form when a client is highlighted and i m confused as whether i can use the current dataset or have to create a new one. I have created a thread:
http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2861198[^]
Would really appreciate the advice
C~Rose
|
|
|
|
|
Check the properties of the DataGridView for appearance changing, they are not very fancy though. If you want something extraordinary, you'll need to implement it yourself or get a third party gridview control.
For the master-detail see this link[^], and try to google around, you'll get a lot of examples.
Regards,
Lev
|
|
|
|
|
I need to create simple application wich is Web Browser that opens new windows in existent browser.
For example I open website that have some link wich should open in new window. (a href="..." target="_new")
When i click on this link, new page will open in the same window.
Server mast see that i clicked on the link and over to link's site.
|
|
|
|
|
use
<a href="a.html" target="_blank">Link</a>
Use "_blank" instead of "_new"
|
|
|
|
|
I think this question has nothing to do with C#...
Regards,
Lev
|
|
|
|
|
No...
I need that all new windows(include pop-ups) will open in existing web browser.
|
|
|
|
|
good day people
so i created a mainMenu in my windows form and i wanted icons in the menuItems, i found my solution here
http://www.codeproject.com/KB/menus/cs_menus.aspx[^]
problem is it sets the OwnerDraw property to true and then i cant set my shortcut keys to show that way
i go menuItem1.Shortcut = Shortcut.CtrlV;
menuItem1.ShowShortcut = true;
and it keeps showing me this in menuItems --> "&Menuitem1"
when it should be ---> "MenuItem1 Ctrl + V "
how can i have icons in my menuItems AND have Shortcut keys too? (im using Visual studio 2003)
thanks in advance
|
|
|
|
|
When you use OwnerDraw, then you have to draw everything you want to see yourself,
including shortcuts.
Obviously you would still want to set the Shortcut property itself so it remains operational.
|
|
|
|
|
yeah i thought id have to but how can i do that?
after i draw the menuitem i did this
menuItem3.Shortcut = Shortcut.CtrlV;
menuItem3.ShowShortcut = true;
obviously that wasnt enough
so how can i do it???
thanks in advance
|
|
|
|
|
Hi,
use the same way you do the menu text itself, call Graphics.DrawString using a font, a color and a position of your choice.
|
|
|
|
|
and that would make it operational too? because the other problem is that it doesnt work when i do Crtl + S, it doesnt do anything
thanks i will give it a try hopefully i dont return here in a few minutes
modified on Friday, December 26, 2008 11:06 AM
|
|
|
|
|
well i still cant make my shortcut functional
now the text is correct "MenuItem3 Ctrl+S"
but when i set the Shortcut property Shortcut.CrtlS;
the menu starts blinking and still it doesnt work when i press the shortcut keys i set
|
|
|
|
|
hi,
i have a small question..
How can i add and access a ComboBox in dataGridView..
i means,how can i add new Lines in these ComboBoxes and check which line is selected?
thank you
G.
|
|
|
|