|
A bit of searching found this - hope it helps. With the source code you have you should be able to recreate it - Good luck
OPEN "COM1:[speed],[parity],[data],[stop]" FOR [FILEMODE] AS #FileNumber
CD0 = zero milliseconds timeout on the data carrier detect line (DCD)
CS0 = zero milliseconds timeout on the clear to send line (CTS)
DS0 = zero milliseconds timeout on the data set ready line (DS)
RS = suppress detection of request to send (RTS)
Dave
|
|
|
|
|
that is useful info, if only Scalpa gets to see it, you did reply it to me...
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
thanks to you both.
Scalpa
|
|
|
|
|
Ok, I was trying to connect a PC(XP pro) to a SARTORIUS lab balance model BP3210S and also model 1413. Via Serial rs232
I finally made it work.
The main problem was the escape sequence sent to the port.
Here is the code.
Create a Windows C# project with 1 textbox and 1 button and drop this code behind form1.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.IO.Ports;
namespace AnotherSerial
{
public partial class Form1 : Form
{
SerialPort sp = new SerialPort("COM1", 1200, Parity.Odd, 7, StopBits.One);
public Form1()
{
InitializeComponent();
//Subscrib deleguate to even
sp.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);
}
private void sendButton_Click(object sender, EventArgs e)
{
try
{
textBox1.Text = "";
char cCHR27 = (char)27;
sp.ReadTimeout = 500;
if (sp.IsOpen) sp.Close();
sp.Open();
sp.DtrEnable = true;
sp.Write(cCHR27 + "P"); 'Escape
}
catch (System.Exception ex)
{
textBox1.Text = ex.Message;
}
}
private void ReadButton_Click(object sender, EventArgs e)
{
try
{
//clear the text box
textBox1.Text = "";
//read serial port and displayed the data in text box
if (sp.IsOpen) sp.Close();
sp.Open();
//textBox1.Text = sp.Read() + " Received";
}
catch (System.Exception ex)
{
textBox1.Text = ex.Message;
}
}
private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
// Event for receiving data
// Read the buffer to text box.
this.Invoke(new EventHandler(DoUpdate));
}
private void DoUpdate(object s, EventArgs e)
{
textBox1.Text = textBox1.Text + sp.ReadExisting();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
It works
Thanks all.
|
|
|
|
|
Hi!
I'm creating an application using C# and I need to display one or more markers in a webBrowser object using Google Maps.
The problem is that I was thinking to create only one HTML file that I could change automatically everytime I need to display something. Like this I need to edit this file with the right code (HTML and JavaScript) and than open it in the webBrowser object. This file would be located on local disk and not on a public website.
Do you think that this is the best way to do this? If not, what do you think i should do?
If it is, how can I edit a HTML file using C#?
Here's an example:
http://www.uploadhouse.com/viewfile.php?id=1267023[^]
Thanks in advance !!!
|
|
|
|
|
|
Thanks for the tip!
I'm going to take a look at the MSDN code that you post it.
Looks to me that it can help me.
However, I still don't know if this is best way to do this kind of implementation.
Any suggestions will be welcome.
Thanks!
|
|
|
|
|
I had to do the same thing last year. What I intended to be a c# application turned out to be mostly a javascript application. The only part that was c# was building the coordinate file to be used by the javascript.
MrPlankton
|
|
|
|
|
Hi, thanks for your post!
And you made it like this or not?
Can you explain me, in a very brief way, how did you implement this?
Thanks!
|
|
|
|
|
Hello!
I'm having a strange problem with a combobox I have added into my DataGridView object.
While runing my program, rows are added in to the DataGridView. When I check in the ComboBox, I can't see or use my collections items which i entered in the Edit Columns property window! Why is this happening?
I also want to know how to insert own items to the collection while running the program.
Hope someone have some answers!
/Mc_Topaz - It's Mc, not Mac. I'm not scottish!
|
|
|
|
|
Hello,
How can I write to office word document from c# related texbox and comboboxes? Is there any article or small example about this subject?
Good Days
|
|
|
|
|
Search for 'word object model'
|
|
|
|
|
I create a DataSet with 4 tables in it from a mdb file using the Wizard of the VS Express 2008. I have a DataGridView and I display the data of the "Transaction" table. I also have a table with my suppliers called "Suppliers". In "Transaction" table I have a column called "Supplier".
I have enabled the options to add,edit or delete record in the DataSet and to save all the changes back to the mdb file. To provide an easier way for the user to add new records I set "Supplier" columnType in the DataGridView as DataGridViewComboBoxColumn and DisplayMember, DataSource and ValueMember to the "Name" column in the Supplier table so the user can directly select the name name of the supplier without having to type it.
So when I run the program and load the form I get the following error message:
System.ArgumentException: DataGridViewComboBoxCell value is not valid.
Any help would be appreciated....
Thank you
|
|
|
|
|
yeah that DataGridViewComboBoxColumn is a tricky lil bugger!
ive had a problem with mine for almost two weeks now. but my problem is that the table in question references itself
good luck tho
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
Check the AutoSizeMode property of your DataGridView .
You may have set some column(s) to expand the column width to fit the data. Depending on what data you have there (or actually you don't have ), you will get that kind of error if the lookup is turned on.
SkyWalker
|
|
|
|
|
Hi all...
I made a program in C# which takes any command and show the output in richtextBox...Everything is working fine except tht whenever i try to run my exe in some different computer it shows different error...In some computer it shows ".Net Framework Error" some computer do nothing i mean when i click on exe it do nothing and in some computer it throws exception...
I've no idea why this is happening...Can someone help me out..Am i missing anything?? I made exe in release mode...
Thnks..
Ash..
|
|
|
|
|
Make sure the different computers have the .NET framework installed and the correct version for your application.
If you make a setup project you can make it detect this and download the framework during install.
Dave
|
|
|
|
|
Thnks all
But it's very small project..It works fine in other PC's having .NET Framework..
Do i need to add some configuration file so that it works fine everywhere without taking care whether .Net Framework is installed or not..
So sorry for simple question...I just start working in c#..
Ash..
|
|
|
|
|
If the correct version of the framework isn't installed it will not run.
If the other PCs are running Vista and your app requires administrator rights then you'll need to add an application manifest so UAC prompts for it to be allowed. I've mentioned this before somewhere, I'll try and find the link.
Dave
|
|
|
|
|
Tht will be very helpful for me..
Thnks..
Ash..
|
|
|
|
|
I can't find it but it's very simple.
How to prompt for UAC elevation in Vista.
In Solution Explorer, right click your project and select Add|New Item. Select Application Manifest File and click Add.
In the app.manifest file, change the line that reads
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
to
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
Dave
|
|
|
|
|
I tried dave but it's not working... Now it's not giving any error but showing nothing...
Neverthless thnks..
Ash..
|
|
|
|
|
I think you need to put some try/catch blocks in your app and write any caught exceptions to the event log so you can see what's happening or where it's locking.
Dave
|
|
|
|
|
Yeah i think same...I'll do this and let you know..
Ash..
|
|
|
|
|
Make sure that .Net Framework is installed on each computer where you are deploying your executable. Also, check that there are all the files that are referenced by your program.
|
|
|
|