|
Thanks !!!!!!!!!!!!!!!!!
One nation - underground
|
|
|
|
|
Sir, can I have a doubt that If C# does not support Pointers then how C# is able to Support Runtime Polymorphism ? Pls help me in understandig the concepts better.
Thanking You
Fly Like An Eagle With MIGHTY POWER.
|
|
|
|
|
|
You should've been here yesterday
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
I created a small Windows form using C# that add and remove text from a file. To run the Windows form a user just need to click on the "Enablelog.exe." The "Enablelog.exe" only has a name attached to it(Enablelog.exe) which make it looks very plain. Can some one show me how I can add an image to it so that it will be on the "Enablelog.exe" and make it looks more professional. I am using Visual Studio 2005.
Any help will greatly be appreciated,
Donjuanwu
|
|
|
|
|
Try using an Icon
If you created the project with Visual Studio then you should have a "app.ico" or something like this into the project files
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
In your project's property => Application pane => you'll find a ComboBox to choose an icon for your application.
Regards
|
|
|
|
|
Vlad Stanciu and Nader Elshehabi thank you very much.
|
|
|
|
|
Hi
I'm trying to send mail through the MailMessage object.
I know that the body property of the message receives a string.
I wanted to know if there is a way to set the body of my mail to load an HTML file (or any other file, for that matter) so that the mail will not consistof a text only.
thanks
|
|
|
|
|
System.Web.Mail.MailMessage msg;
System.Web.Mail.SmtpMail.SmtpServer = "your.smtp.server.com";
msg = new System.Web.Mail.MailMessage();
msg.BodyEncoding = System.Text.Encoding.ASCII;
msg.From = txtFrom.Text;
msg.To = txtTo.Text;
msg.Cc = txtCc.Text;
msg.Bcc = txtBcc.Text;
msg.Subject = txtSubject.Text;
msg.Body = txtBody.Text;
System.Web.Mail.SmtpMail.Send(msg);
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi everybody,
Is there an attribute or some other way to validate that a property has a unique value.
To illustrate what i mean, watch the "Name" property in the property grid of each control added to a windows form. It is unique!
How can i achieve this capability too?
Thanks in advanced,
elaj
|
|
|
|
|
Hi all,
i am going to write window form application in C# that has TextBox and other control on it. i want to support two languages input for same one textbox depending on user selection via some radio buttons. i have searched on internet but all the posts say language can be changed for current thread. this means it will change language for all the controls on the from. please help me how can i change language on one particular textbox on run time.
Regards,
Omar Lodhi
|
|
|
|
|
first you must know you can not install/uninstall language supports in windows itself. That means that you can only support these languages only if they are supported by the user's windows.
Now to the issue. You can handle two events to manage that: Enter , and Leave .
In the Enter event handler you set Application.CurrentInputLanguage property to whatever you want, then on Leave event handler you change it back to the original.
Regards
|
|
|
|
|
Hello friends need help here..
Before this I have learn to create password validating form.Which is user have to key in password to enter another form. The password is default that have set in the coding.Now I need help how to connect to MY Sql database from C# from and compare the password that already I set in MY Sql database,table name Security and Field name password and the password is "ABCD".I dont know how to use SQL server 2005.
Below are the coding for the first form that validate to enter to form2.
//////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace cubaan1
{
public partial class Form1 : Form
{
Form2 form1 = new Form2();
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
textBox1.PasswordChar = '*'; //Masking Char
textBox1.MaxLength = 14;//Max Length is 14
}
private void button1_Click(object sender, EventArgs e)
{
string strDefaultPassword = "security"; //Keep the default password
string strEnteredPassword = textBox1.Text;
if (strEnteredPassword == strDefaultPassword)
{
this.Hide();
form1.ShowDialog();
}
else
{
MessageBox.Show("Wrong password entered");
this.Close();
}
}
}
}
//////////////////////////////////////////////////////////
How to change this to connect to MY Sql Database and compare the password from the database.
Tq in advance......
|
|
|
|
|
In the validation procedure (button1_Click) connect to the mysql database with a special driver (either odbc or a dedicated one from the mysql site) - check http://www.connectionstrings.com/[^] for aditional info.
Use ado.net to retrive the password for your user (dataTable, dataTableAdaptor and other stuff like this - check articles for this on codeproject).
The database querry should return only one value (the password) for the specified user. And olso, try to use parameters with regex in the querry to aviod insertion attacks.
Good luck.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Can you show me where to put the coding , I can understand.
Tq very much.
|
|
|
|
|
i am trying to access methods of windows Service from another project or Application is it possible? except Start, Stop method of Windows service.
suppose in my window service i have method like this for Creating a folder in C: drive.
// this service class one Method.
public void mthCreateFolder()
{
//logic for creating folder
}
When i use System.ServiceProcess class using The name of the Service i can access Start, Stop, Restart Method of That Service. But now i want to Access method mthCreateFolder of that service. Plz help me?
Sanjit.rajbanshi@wlinktech.com
|
|
|
|
|
If you programmed that service you can use Remoting to communicate between your application and that service, and then call that method.
If not!! Then I don't think you'd be able to do it.
Regards
|
|
|
|
|
I have the RichTextBox. And I was wondering how would I be able to how the user to place a table into the RichTextBox?
|
|
|
|
|
Hello everyone,
I need some idea since I am running out of my own and haven't been able to get it working.
I have a file called temp.txt which hold temparary data and will be deleted at the end of the Windows Application life. I have another file called perm.txt which is similar to the temp.txt file but it hold the saved data.
In order to avoid multipler data registration I would like to check to see if a particular data from temp.txt file has already been registered or not. If it hasn't then I will go ahead to save/register it into save.txt file. That is if the user choses to Save its temp.txt content by clicking on the SAVE button.
Any suggestion in this issue will be greatdly appriciated. Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
post the code if you want some help
|
|
|
|
|
I don't quite understand the problem/question.
As I understand the situation:
You save data in a temporary file which is deleted when the application exits.
There is another permanent file where the data in the temporary file is written/moved as long at the data doesn't already exist in the permanent file.
This would require your code to perform the following:
Read a record from the temporary file.
Read the contents of the permanent file searching for a matching record.
If no record is found in the permanent file, append the permantent file with the new record.
Depending on the size of the files and number of records, you may be able to read both files into memory when making comparisons and after any additions, simply write out a new permanent file from the records in memory.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
View my Blog
|
|
|
|
|
In addition to what Wayne Phipps said, I'd suggest that you store the records as Hash codes in a HashTable. This way you can compare small integers instead of large records, which could boost your performance dramatically.
Regards
|
|
|
|
|
Hi there, ive kind of an issue.... my prob is that im using a TCPListener in a class named Soctek_Server, and i have a form1, so i put a timer on the form in order that the code on the class keep executing, my prob is that only when a client made a request my form1 refresh its content, but until that happend all the form, the visual thing stays in white, all the application stays in a queue... it paralize, what i need to do , is make something with threads, to put the TCP listener in a thread independet of the form that way i could work whit the form.... not mattering if the TCPlistener is active or not. if someone can help me ..... plz
Ive been trying something with threads with the function "pintar" but it doesnt work, the form still paralize when the timer is running....
Here is the code
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Test
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
private IContainer components;
private System.Windows.Forms.Button cmdserver;
private System.Windows.Forms.Button cmdclient;
public Socket_Server server;
private System.Windows.Forms.TextBox txtmsg;
private System.Windows.Forms.Label label1;
public Socket_Client client;
private Timer timer1;
System.Threading.Thread myThread;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
server= new Socket_Server();
client = new Socket_Client();
myThread = new System.Threading.Thread(new System.Threading.ThreadStart(pintar));
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.cmdserver = new System.Windows.Forms.Button();
this.cmdclient = new System.Windows.Forms.Button();
this.txtmsg = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// cmdserver
//
this.cmdserver.Location = new System.Drawing.Point(216, 120);
this.cmdserver.Name = "cmdserver";
this.cmdserver.Size = new System.Drawing.Size(75, 23);
this.cmdserver.TabIndex = 0;
this.cmdserver.Text = "Servidor";
this.cmdserver.Click += new System.EventHandler(this.cmdserver_Click);
//
// cmdclient
//
this.cmdclient.Location = new System.Drawing.Point(216, 176);
this.cmdclient.Name = "cmdclient";
this.cmdclient.Size = new System.Drawing.Size(75, 23);
this.cmdclient.TabIndex = 1;
this.cmdclient.Text = "Cliente";
this.cmdclient.Click += new System.EventHandler(this.cmdclient_Click);
//
// txtmsg
//
this.txtmsg.AcceptsReturn = true;
this.txtmsg.Location = new System.Drawing.Point(216, 84);
this.txtmsg.Name = "txtmsg";
this.txtmsg.Size = new System.Drawing.Size(280, 20);
this.txtmsg.TabIndex = 2;
this.txtmsg.Text = "txtmsg";
this.txtmsg.TextChanged += new System.EventHandler(this.txtmsg_TextChanged);
//
// label1
//
this.label1.Location = new System.Drawing.Point(216, 248);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(100, 23);
this.label1.TabIndex = 3;
this.label1.Text = "label1";
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(512, 342);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtmsg);
this.Controls.Add(this.cmdclient);
this.Controls.Add(this.cmdserver);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
//System.Threading.Thread myThread;
//myThread = new System.Threading.Thread(new System.Threading.ThreadStart(Test.Form1.Main));
//myThread.Start();
}
private void Form1_Load(object sender, System.EventArgs e)
{
Test.Socket_Server.CreateLabel(this);
}
private void cmdserver_Click(object sender, System.EventArgs e)
{
label1.Text = "ENTRANDO A SERVER";
server.Begin();
}
private void cmdclient_Click(object sender, System.EventArgs e)
{
myThread.Start();
}
private void txtmsg_TextChanged(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
timer1.Enabled = true;
label1.Text = timer1.Interval.ToString();
server.Begin();
//myThread.Start();
}
public void pintar()
{
label1.Text = "entre al thread";
//myThread.Suspend();
}
}
}
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Collections;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Globalization;
namespace Test
{
///
/// Summary description for Socket.
///
///
public class Socket_Server
{
private static Label label;
public Socket_Server()
{
//
// TODO: Add constructor logic here
//
}
public static void CreateLabel(Control Form1)
{
label=new Label();
label.Height=400;
label.Width=200;
label.Location = new Point(10,10);
label.Enabled = false;
label.Visible=true;
Form1.Controls.Add(label);
}
public void Begin()
{
try
{
IPAddress ipAd = IPAddress.Parse("148.210.182.80");
// use local m/c IP address, and
// use the same in the client
/* Initializes the Listener */
TcpListener myList=new TcpListener(ipAd,8002);
/* Start Listeneting at the specified port */
myList.Start();
label.Text=label.Text+"/r"+("The server is running at port 8001...");
label.Text=label.Text+"\r"+("The local End point is :" +
myList.LocalEndpoint );
label.Text=label.Text+"\r"+("Waiting for a connection.....");
Socket s=myList.AcceptSocket();
label.Text=label.Text+"\r"+("Connection accepted from " + s.RemoteEndPoint);
byte[] b=new byte[100];
int k=s.Receive(b);
Console.WriteLine("Recieved...");
for (int i=0;i
|
|
|
|
|
I am currently having dificulties in understanding your problem. Please be a little more specific and maybe I can help you...
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|