|
I have searched Code project for the articles for programming using MAPI.
But I couldn't find a solution for it.
Can any one give the link or the suggestions to program using Extended MAPI in .NET.
Thanks a lot in advance.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Try this article [^]
Hope it helps.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
Hello
Any body know how can I define a const table like this in c#
-----------+------------+--------------+---------------
int_number | int_number | float_number | bool_variable
int_number | int_number | float_number | bool_variable
int_number | int_number | float_number | bool_variable
...
thanks
Beginner in C#
|
|
|
|
|
|
What do you mean by a "const table"?
Constants can only be simple values, like a number or a string. You can's create collecions of objects as constant.
---
single minded; short sighted; long gone;
|
|
|
|
|
I done the rs232 application.Executing is successfully.But showing Unable to open comport.In my application i have open the comport.
|
|
|
|
|
I want to write data received from serial COM port to an Excel data base. I'm really confused abt how to use it. If sumone can help me it'll be really appreciated.
Thank you
|
|
|
|
|
There are several ways to do this. One is presented here [^] which uses Microsoft Excel Object Library. You can also try writing to a CSV file, which is easier, and Excel knows how to open these kind of files or you can try using OleDB or ODBC. You can find the connection string here [^], and if you search on google you will find several tutorials and applications.
Hope it helps.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
Thanx alot for the help, it was really useful.
|
|
|
|
|
Error: The name port does not exit in current context.
This is my coding part
using System.IO.Ports;
namespace RS232_Tester
{
public partial class Rs232 : Form
{
string InputData = String.Empty;
// This delegate enables asynchronous calls for setting
// the text property on a TextBox control:
delegate void SetTextCallback(string text);
public Rs232()
{
InitializeComponent();
// Nice methods to browse all available ports:
string[] ports = SerialPort.GetPortNames();
// Add all port names to the combo box:
foreach (string port in ports)
{
cmbComSelect.Items.Add(port);
}
}
private void cmbComselect_SelectedIndexChanged(object sender, EventArgs e)
{
if(Port.IsOpen)port.Close();
port.PortName = cmbComSelect.SelectedItem.ToString();
stsStatus.Text = port.PortName + ": 9600,8N1";
// try to open the selected port:
try
{
port.Open();
}
// give a message, if the port is not available:
catch
{
MessageBox.Show("Serial port " + port.PortName +
" cannot be opened!", "RS232 tester",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
cmbComSelect.SelectedText = "";
stsStatus.Text = "Select serial port!";
}
}
private void button2_Click(object sender, EventArgs e)
{
if (port.IsOpen) port.WriteLine(txtOut.Text);
else MessageBox.Show("Serial port is closed!",
"RS232 tester",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
txtOut.Clear();
}
private void button1_Click(object sender, EventArgs e)
{
txtIn.Clear();
}
private void port_DataReceived_1(object sender,SerialDataReceivedEventArgs e)
{
InputData = port.ReadExisting();
if (InputData != String.Empty)
{
string[] ports = SerialPort.GetPortNames();
// txtIn.Text = InputData;
// because of different threads this
// does not work properly !!
foreach (string port in ports)
{
cmbComSelect.Items.Add(port);
}
}
}
/*
To make a thread-safe call a Windows Forms control:
1. Query the control's InvokeRequired property.
2. If InvokeRequired returns true, call Invoke with
a delegate that makes the actual call to the control.
3. If InvokeRequired returns false, call the control directly.
In the following code example, this logic is
implemented in a utility method called SetText.
A delegate type named SetTextDelegate encapsulates the SetText method.
When the TextBox control's InvokeRequired
returns true, the SetText method creates an instance
of SetTextDelegate and calls the form's Invoke method.
This causes the SetText method to be called
on the thread that created the TextBox control,
and in this thread context the Text property is set directly
also see: http://msdn2.microsoft.com/en-us/library/ms171728(VS.80).aspx
*/
// This method demonstrates a pattern for making thread-safe
// calls on a Windows Forms control.
//
// If the calling thread is different from the thread that
// created the TextBox control, this method creates a
// SetTextCallback and calls itself asynchronously using the
// Invoke method.
//
// If the calling thread is the same as the thread that created
// the TextBox control, the Text property is set directly.
private void SetText(string text)
{
// InvokeRequired required compares the thread ID of the
// calling thread to the thread ID of the creating thread.
// If these threads are different, it returns true.
if (this.txtIn.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(SetText);
this.Invoke(d, new object[] { text });
}
else this.txtIn.Text += text;
SetText(InputData);
}
}
Srinu
|
|
|
|
|
You are trying to use a variable that is not declared where you are trying to use it. There are only two variables declared with the name port, and they only exist inside the foreach loops.
---
single minded; short sighted; long gone;
|
|
|
|
|
I want the modifying code.Where it is modify in my application.
|
|
|
|
|
You are using variables that you never created. You have to create every variable that you use, and you have to assign it a useful value.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi Guys. I have tried a few dirrent ways of doing this but none of them seem to work for me. I am trying to get the "username" copied from my logon form into the Main form.
The logon form is called from the mainform. user enters username and password and it gets validated in the code as below. If all is fine then the main form is displayed.
However, I am trying to get the username from textBox1 copied to a label "lblUserName" in the Mainform. How do I get this to work? I am able to get the text from textBox1 copied to a lbluser on the Logon form but can't get it over to the Mainform. Any help would be GREATLY appreciated.
public partial class Logon : Form
{
public Logon()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
NEF frm = new NEF();
if (textBox1.Text == "maphanga" && textBox2.Text == "marsha"
|| textBox1.Text == "nkosi" && textBox2.Text == "mdu"
|| textBox1.Text == "carrim" && textBox2.Text == "allerece"
|| textBox1.Text == "raphela" && textBox2.Text == "rachel"
|| textBox1.Text == "mazibuko" && textBox2.Text == "zoliswa")
{
this.DialogResult = DialogResult.OK;
}
else MessageBox.Show("Invalid username and or password supplied");
lbluser.Text = textBox1.Text;
frm.Close();
MessageBox.Show(lbluser.Text);
}
}
"I'm just so confused I can't remember my own name"
|
|
|
|
|
|
Why don't you add a property to the logon form:
...<br />
<br />
public string Username<br />
{<br />
get {return textBox1.Text}<br />
}<br />
...
And in the MainForm you add:
LogonForm oForm = new LogonForm();<br />
if( oForm.ShowDialog() == DialogResult.OK )<br />
{<br />
lbluser.Text = oForm.Username<br />
}<br />
else<br />
{<br />
}
Visit my blog at http://dotnetforeveryone.blogspot.com/
|
|
|
|
|
Brilliant. First suggestion that actualy worked. Much appreciated. I tried so many different suggestions and none of them worked.
Now I can sleep again!!!!!
|
|
|
|
|
Hello,
You have to care about Resourcess.
In the example the loggonForm is not going to be disposed.
If you allways want to instanciate a new LoggonForm, I would suggest to use a 'using' block, which is doing the disposing for you:
using(LogonForm oForm = new LogonForm())
{
if( oForm.ShowDialog() == DialogResult.OK )
{
lbluser.Text = oForm.Username
}
else
{
}
}
Or instanciate the Form once and hold the reference in your mainform, as long as you need it.
All the best,
Martin
|
|
|
|
|
Well, I can see two ways to accomplish what you want.
1) Set the constructor for the main form to receive a string as a parameter and display that string on the form. Something like this.
public partial class Logon : Form
{
public Logon()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
NEF frm = new NEF(textBox1.Text);
frm.ShowDialog();
Application.Exit();
}
}
public partial class NEF: Form
{
public NEF(string username)
{
lblUserName.Text = username;
}
}
2) You can set the textBox1 modifiers to public and call the logon form from the main form (that means that in Program.cs, you should set Application.Run(new NEF()). Here is an example
public partial class NEF:Form
{
public NEF()
{
}
private void FormLoad(object Sender, EventArgs e)
{
Logon frm = new Logon();
if (frm.ShowDialog() == DialogResult.OK)
{
this.lblUserName = frm.textBox1.Text;
}
}
}
public partial class Logon : Form
{
public Logon()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "maphanga" && textBox2.Text == "marsha"
|| textBox1.Text == "nkosi" && textBox2.Text == "mdu"
|| textBox1.Text == "carrim" && textBox2.Text == "allerece"
|| textBox1.Text == "raphela" && textBox2.Text == "rachel"
|| textBox1.Text == "mazibuko" && textBox2.Text == "zoliswa")
{
this.DialogResult = DialogResult.OK;
}
else MessageBox.Show("Invalid username and or password supplied");
lbluser.Text = textBox1.Text;
}
}
Hope it helps.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
hi,
i have a textbox and a datagrid....wen i enter any text in the textbox and wen i click on an update button i want the datagrid to be updated.....
i know the code has to be written in the update button press....but i dont know how to proceed from here.....
please help.....
also any urls that will explain the basic datagrid usage will be good
thanking you
j
|
|
|
|
|
On the button click event write this code
dataGridView1.Rows.Add(textBox1.Text);
Of course you have to add one column to the datagridview at design time.
Trustapple wrote: also any urls that will explain the basic datagrid usage will be good
Try these links [^]
Hope it helps.
There are 10 kinds of people: those who understand binary and those who don't
|
|
|
|
|
hi Andrei,
you are awesome.....
thankyou for helping me so much.......
hope to catch you again
cheers
jiju
j
|
|
|
|
|
I prinr line's text on X and Y location
I use "System.Drawing.Printing.PrintPageEventArgs e"
and evey time It do the task ,I cange only one text
on the page.
but it's run very slow.
I print about 2000 pages!!
how can I save the "event e" and add to the end one text and then print the page???
can I save It into file??? but remember that I have location X and Y
to the text and the line's
|
|
|
|
|
I think you can save it in a collection like : List<printpageeventargs>
Put that list as member variable.
|
|
|
|
|
How do you mean ???
How can It work's
|
|
|
|