|
Hey!
I have a Usercontrol that contains several controls. There is onlye one of these controls that may ba focused by using tab(tab index = 1 and tabstop = true). The other controls in this usercontrol have index = 0 and tabstop = false.
On the mouse over event on this focusable control i se the control to focus(ex this.txtBox.Focus();) and this works fine.
But when i try to use Tab to leave the usercontrol there simes like another control get focused and I have to press tab twice to leave the usercontrol.
Any ide how to lose the focus/activ of the usercontrol on TAB? I want the next usercontrol or regular control to become focused on one TAB press.
|
|
|
|
|
Hi friends,
I am facing a PROBLEM WHILE I send mails with the SMTP class of System.Net.Mail.
The code shows below.
MailMessage mail = new MailMessage();
//set the addresses
mail.From = new MailAddress("from@domain.com");
mail.To.Add("to@domain.com");
//set the content
mail.Subject = "This is an email";
mail.Body = "this is the body content of the email.";
//send the message
SmtpClient smtp = new SmtpClient("mysmtpserver.net");
//to authenticate we set the username and password properites on the SmtpClient
smtp.Credentials = new System.Net.NetworkCredential("user@domain.com", "password");
smtp.Send(mail);
I have a valid smtp server name, username and password. I configured it to outlook and working fine. And wen I test it using telnet port 25 then also its working.
I upload the file to my hosting space. I have two hosting account with godaddy.
The mailing script is working fine in one hosting account. That hosting account have SSL and dedicated IP address.
But the mailing code is not working in the other hosting account. That hosting account is Windows hosting + ASP.NET 2.0 supported.
The error I am getting is as shown as below.
System.Net.Mail.SmtpException: Failure sending mail. ---> 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 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- End of inner exception stack trace --- at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at _Default.Button1_Click(Object sender, EventArgs e)
Please help me on this issue....
Thanks in advance....
-- modified at 5:38 Friday 9th March, 2007
JIJO BABY - Lets Play C#
|
|
|
|
|
heck this out
http://www.codeguru.com/csharp/.net/net_asp/email/article.php/c12755
saeee
|
|
|
|
|
Thanks Saeee.
But the code is working in one of my domain. Its not supporting in my new doamin. I mean new hosting account.
I tried System.Web.Mail and System.Net.Mail.
I am getting same error.
JIJO BABY - Lets Play C#
|
|
|
|
|
I am writing an simple application that will delete a file/directory. The application recives the target file as an argument. I have also put a shortcut in the W Explorer contextual menu, via Shell registry subkey of the folder entry
in the HKEY_CLASSES_ROOT.
[HKEY_CLASSES_ROOT\Folder\shell\NewMenuOption]
@="Wipe it ..."
[HKEY_CLASSES_ROOT\Folder\shell\NewMenuOption\command]
@="D:\\FileWiper\\bin\\Debug\\FileWiper.exe \"%1\""
If a launch the program from a shell with an filename/folder as an argument it does it's job.
But if the program is launched via the option in the Explorer menu and the selected targer is a folder (with a simple file it works), then the deleting fails with the exception " ... file being used by another process". It seems that the program keeps an open handle on the directory. The delete operation is made via Directory.Delete() ( tried also working with DirectoryInfo ...same result).
Any one has any idea how can I get past this ?
------------------------------------------------------------------
LATER EDIT : I managed to track the problem after all. Simple stuff really, but forgot about it. Windows set the current directory for the program was set to be the target directory, so a simple change of the current directory was enough to get the program going.
-- modified at 4:04 Friday 9th March, 2007
|
|
|
|
|
My IE 6 is not showing any popups. I am not using any popup blocker or something..Help
Ranjith
|
|
|
|
|
Ranjith could you check the popup blocker setting comming with IE7 itself
Go to tools pop up blocker and turn it off.
Let me know if it helps
|
|
|
|
|
Thanks for replying....
But I am not using IE7. The pblm is with my IE6.
Ranjith
|
|
|
|
|
Do you have any Yahoo toolbar. It comes with a popup blocker. There may be any other toolbar that might be having a popup blocker. Check that and disable it.
|
|
|
|
|
I am trying to create an application that simply starts listening on a specific port number on the local machine, and writes all data received to a text box on the form. There will be a 3rd party application that is sending data th my IP address on a specific port number.
From what ive been reading, maybe I should use a TCPListener but Im not sure where to start.
Any help would be appreciated.
Thanks.
|
|
|
|
|
|
Hi shanthi,
You can find classes to work with Active Directory on System.Directory Services namespace. Please dig in to msdn which will help you do this.
If time allows i will create some working code to do this.
Neo
|
|
|
|
|
Hello,
How to get number of user accounts and there domain name in the machine
in C#.Net.
Thanks in advance.
Rahul Kulkarni
|
|
|
|
|
I am not sure if you have function to do this in .net how ever following WMI class will help you.
using System.Management;
.
.
.
public void GetOsDetails_Win32_Account()
{
ObjectQuery queryObject = new ObjectQuery("select * from Win32_Account");
ManagementObjectSearcher searchObj = new ManagementObjectSearcher(queryObject);
ManagementObjectCollection collection = searchObj.Get();
foreach(ManagementObject obj in collection)
{
Console.WriteLine("Caption:"+obj["Caption"]+
"\n"+"Domain:"+obj["Domain"]+
"\n"+"NAME:"+obj["Name"]+
"\n"+"LocalAccount ?:"+obj["LocalAccount"]+
"Status:"+obj["Status"]+"\n");
}
}
more values on this class are availe on
http://msdn2.microsoft.com/en-us/library/aa394061.aspx
Please let me know if it helps.
Neo
|
|
|
|
|
Thanks..
It is giving me all user's information of my pc as well as
all domain user also.
Can i get only admins of my pc?
Thanks in advance.
Rahul Kulkarni
|
|
|
|
|
Hi Rahul,
Please try changing the query in the earlier code ie
select * from Win32_Accounts to select * from Win32_Group where name = "Administrator".
This will provide you with all the users in the admin group.The class Win32_Group is a inherited from Win32_accounts.
I have not tested this code but theoretically it should do the purpose.
Please let me know if it works.
Neo
|
|
|
|
|
I have a set of forms I want to open them at the same position.
When I close a form and open another, it changes the position.
I tried using MDI forms too. But MDI parent form comes with a menu bar.
I dont require it.
What can I do?
Nana
|
|
|
|
|
Hi Nana,
If you want any form to appear in a specified location you can specify the same in the Form.Location property eiter in the design time or in the run time as
this.Location = new Point(x,y); In run time.
Let me know if it helps.
Neo
|
|
|
|
|
Thanks neo.
Giving at runtime, its working properly.
thanks once agian
Nana
|
|
|
|
|
How to translate numbers to a different language using c#.net
...............
|
|
|
|
|
Hi,
Rendering numbers to user interface is not managed by the .Net Framework but by the OS. So the number is displayed depending on regional settings.
HTH.
|
|
|
|
|
HI, all
i need help reg. datagridview of C# Windows Application.
please guide me(if possible with a sample), how to get values from an xml in to Datagridview of C#.net2.0WINDOWS APp
thnx in advance,
prashanth,
s/w Engineer,
Syfnosys.
|
|
|
|
|
I am not sure But try creating one dataset and using datasets ReadXML method read the XML file you want. Set datasource as this dataset
|
|
|
|
|
Use this Sample.............
I have used DataCaching also in it..........
private void Page_Load(object sender, System.EventArgs e)
{
if(Cache["1"]==null)
{
FileStream fs = new FileStream(Server.MapPath("simple.xml"),FileMode.Open,FileAccess.Read);
CacheDependency cd=new CacheDependency(Server.MapPath("simple.xml"));
DataSet ds=new DataSet();
ds.ReadXml(fs);
DataView xmldata =new DataView(ds.Tables[0]);
Cache["1"]=xmldata;
Cache.Insert("1",xmldata,cd);
}
DataGrid1.DataSource=Cache["1"];
DataGrid1.DataBind();
// Put user code to initialize the page here
}
With Best Regards,
Yogesh
|
|
|
|
|
You may want to try this:
private void cmdGetTrades_Click(object sender, EventArgs e)
{
dsXML.Clear(); // should already be defined else define it here
// allowing user to select file else you can directly hard
// code the file name
openFileDialog1.Filter = "XML Files|*.xml";
openFileDialog1.Title = "Select SWAPs trades' XML file";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
dsXML.ReadXml(openFileDialog1.FileName);
grdTrades.AutoGenerateColumns = true;
grdTrades.DataSource = dsXML;
grdTrades.DataMember = "trade";
grdTrades.Sort(grdTrades.Columns["TradeID"], ListSortDirection.Ascending);
}
}
I am using this so it certainly works! Hope that helps you.
crzYank
|
|
|
|