|
Thanks should go to Steven Baulkum at Iron Mountain Ranch who gave me the snippet.
Electriac
|
|
|
|
|
hi
i want to playback avi stream in my app,how to do ?
|
|
|
|
|
hi.. i wrote a simple mailing program.. it seems to work at times and fails sometimes.. please help.. whenever it fails it throws an SmtpException.. but it works most of the times.. the code is this..
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
namespace hope
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void button1_Click(object sender, EventArgs e)
{
string sender1;
string recip;
string messg;
string subject = "Hope this reaches!!!";
sender1 = textBox1.Text.ToString();
recip = textBox2.Text.ToString();
messg = textBox3.Text.ToString();
sendmail(sender1, recip, messg, subject);
label1.Text = recip;
}
public static void sendmail(string sendr, string rec, string msg, string sub)
{
//create the mail message
MailMessage mail = new MailMessage();
//set the addresses
mail.From = new MailAddress(sendr);
mail.To.Add(rec);
//set the content
mail.Subject = sub;
mail.Body = msg;
//send the message
SmtpClient smtp = new SmtpClient("localhost");
smtp.Port = 465;
//try
//{
smtp.Send(mail);
//}
//catch (Smtp
}
}
}
please let me knw people..
|
|
|
|
|
Unrelated to your code,
I did a similar project in school with Java. Problems I dealt with were:
1. My ISP would not allow my code to run from home for security reasons unless I had a valid email address as the FROM.
2. Some ISP will block it entirely if you do not have a business account (Not likely an intermittent problem).
3. When at school, if I processed the messages too fast, an error would occur, which I fixed with a small 10ms delay in the loop sending the mail. I found this because I could type in a terminal window to send the mails faster than the school would allow them to send
Good Luck
|
|
|
|
|
I'm writing a little media player but I don't know where to position the Video thisVideo = new Video(); line
At the moment I get 'Video is innacessable due to its protection level'.
I have thisVideo.Stop(), Play etc in event handlers and I am using an OpenFileDialog to open media files.
I correctly have using Microsoft.DirectX.AudioVideoPlayback; at the top of the code and the corresponding .NET reference for that library shown in solution explorer.
I am using .NET framework 1.1 and vs2003.
Robert Everett
|
|
|
|
|
Ah, I've found I have to specify a text string (the file to open) in the constructor in that declaration!
|
|
|
|
|
Hai Frenz,
i want to assosiate different icons for different file programatically using C#. i tried bu creating res file. but still after running the code it is not changing the icons... plzz help me out in this...
Rohitha
|
|
|
|
|
This will depend on the type of file you want to change its icon:
If it's your project's file then you can change that in your project's properties. Once you rebuild you'll see the new icon
If it's another type of file like WAV, AVI, MP#, etc.. You have to associate that file type with the software that contains the icon you wish to use.
Regards
|
|
|
|
|
thnks for reply. here i am changing a file which is not havin an icon by default, also that file is creating by me after the execution of my project. wht i want is, if installed this project in som other system there also it should show the same icon which i am giving. i wanna do it programatically.
Rohitha
|
|
|
|
|
Rohithaa wrote: that file is creating by me after the execution of my project.
If so, go to the properties of your project => Application => Change the icon.
Regards
|
|
|
|
|
Hi
I can't use controls like TextBox or DataGridView in simple Class which i added it from Solution Explorer to my project. It seems that needs System.Windows.Form namespace. My problem is this : Class should inherits from "Form Class" for identifying controls and in this case its behavior converts to Form behavior.
<br />
using System.Windows.Form;<br />
.<br />
public class MyClass : Form<br />
{<br />
}<br />
Is there another way to using controls in class without Inheriting from Form?
Tanx
|
|
|
|
|
You class doesn't need to inherit form Form class to recognize the Controls classes, yet it has to inherit from Form class to display those controls as a windows form, unless you got another way of displaying them.
Simply add a
using System.Windows.Forms;
statement to the top of the file, and all Controls -eg. TextBox, ComboBox, etc...- should be recognizable in your code.
Regards
|
|
|
|
|
Hi,
I have several almost identical datagridviews on a form and I want the cellClick event on each of them to refer to the same event code.
I need to know which datagridview triggered the event. I have each dgv have it's own individual tag and I would like to read the tag of the sending dgv.
I can't discover how to read this information although I am sure it is available.
Any ideas please.
TIA
Glen Harvy
|
|
|
|
|
You can't get it from the sender parameter of the event?
only two letters away from being an asset
|
|
|
|
|
That's what I thought but how do you do this.
I try sender. but only get equals, get, get and tostring?
Glen Harvy
|
|
|
|
|
Ok. What error you got?
Regards,
Satips.
|
|
|
|
|
I don't get an error because I don't know how to get the value in the tag.
Here it is:-
<br />
private void bookingCellClick(object sender, DataGridViewCellEventArgs e)<br />
{<br />
}<br />
Obviously I have a fair bit of code in there which works fine when I hard code the value in the datagridview.tag .
Psuedo code would I guess be "sender.Tag.ToString()" .
Glen Harvy
|
|
|
|
|
Yes. Try with the code and tell or paste the code what you have tried in full so that i can get an idea what u have done.
Hope you got me.
Regards,
Satips.
|
|
|
|
|
You need to cast sender to the actual data type of the control. Since your sender is a DataGridView , you would need something like this:
private void bookingCellClick(object sender, DataGridViewCellEventArgs e)
{
DataGridView dgv = sender as DataGridView;
object tag = dgv.Tag;
}
What, exactly, are you trying to accomplish by accessing the Tag property of the control itself rather than data from the actual cell that was clicked? Pretty much anything you need should be available from the e paramater of the event handler.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Thanks - I knew it should be easy. I tried a couple of variations except "sender as" so I was at least on the right track.
I have several datagridviews that display the status of daily booking periods for tennis courts. Whenever a user clicks on one of the cells, the same action is taken no matter which datagridview is clicked with one exception - the name of the underlying datatable. I've set the variable part of each of the datatables in the datagridviews tag and hence the need to read that value.
I did of course do it the other way and have individual events call the required code and pass the hardcoded datatable value to it but that means duplication and I am trying to learn as I go. Obviously I'm trying to code efficiently as well as successfully
If there is something else to learn from this then I am all ears
Glen Harvy
|
|
|
|
|
Glen Harvy wrote: I tried a couple of variations except "sender as" so I was at least on the right track.
Yes, you were definately on the right track. While this isn't a design pattern in the proper sense of the word, it is fairly common. The nice thing with this cast is that if the cast fails it doesn't throw an exception...the variable is null so you can test for that condition before doing more work.
Glen Harvy wrote: I've set the variable part of each of the datatables in the datagridviews tag and hence the need to read that value.
Given the scenario you are working with, this is probably the best option. I believe you can also get a reference to the underlying datasource from the EventArgs, so you could probably also look at the DataTable name.
Glen Harvy wrote: Obviously I'm trying to code efficiently as well as successfully
That is always the best way to do it, but it seems they don't always go hand-in-hand. Code Project is probably one of the best places to learn as you get a wide variety of experience and solutions, plus the benefit of the articles. Sometimes we can be a bit grouchy, but that's usually because we haven't had morning coffee (or tea) yet.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Thanks for your help on this - much appreciated.
Regards to the cats
Glen Harvy
|
|
|
|
|
Hello everyone,
I have some Buttons in my Windows Applicaton which I would like to add some sort of information for them. I was wondering if it is possible to have a text to be come visiable next to the courser once the courser is hovering over the button. Similar to the one you can have on the toolstrip items?
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
I'm presuming that you mean you would like a tooltip when you hover over a button or similar control.
Drag a ToolTip control onto the Windows Form you want, then add some code After the InitializeComponent call like this
MyToolTip.SetToolTip(this.mycontrol, "Some Text To Show When Mouse Is Over");
Where MyToolTip is the name given to the tooltip control and mycontrol is the name of the control you want to add a tooltip to.
Then when you hover over the control your tooltip should be shown,
Mark.
|
|
|
|
|
Hello Mark,
Thanx for the info. I have just tried the ToolTip and this is exactly what I was looking for.
Thank you very much and have a great weekend, mate.
Khoramdin
|
|
|
|