|
You could always stream the StandardOutput to a file - See the docs on MDSN for the System.Diagnostics.Process class
|
|
|
|
|
|
Hi,
I was wondering if there is a way to get all data from the serialport before processing it.
I got an event handler for the serialport and this is how i receive the data:
string buffer += serialport.ReadExisting();
These are my delegate and event to read the data:
public delegate void GetData(string getDataFromBuffer);
public event GetData getTheData;
After that this event handler is fired:
if (this.getTheData != null)
this.getTheData(buffer);
All data i get will be appended to a richtextbox. Problem is, it keeps appending even the data already exists.
It kinda looks like this:
123.
123.455
123.455.5677
But i want to append it all at once.
Any suggestions how to fix this?
Thanks in advance!
|
|
|
|
|
Hi,
If you only want to keep the latest text only, then dont concatenate the original text with the new one.
I think you might be doing something like this -
RichTextBox1.Text = RichTextBox1.Text + this.getTheData(buffer);
Change it to
RichTextBox1.Text = this.getTheData(buffer);
Hope i got what you want, but i am not sure about it.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
Hi,
I got it exactly like how you suggest it to do.
But the buffer still has its data from the previous serialPort.ReadExisting(); execution.
|
|
|
|
|
serialport.DiscardInBuffer();
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
hi..
How i can select single item in a CheckListBox...
I want to eneble it or disble it or i want to check it or uncheck it...
Thanks in adavance,
Vinay
|
|
|
|
|
And the Enabled and Checked properties aren't working for some reason? We need more information.
"Quality Software since 1983!" http://www.smoothjazzy.com/ - see the "Programming" section for (freeware) JazzySiteMaps, a simple application to generate .Net and Google-style sitemaps!
|
|
|
|
|
chkListBox.SelectedIndex = index;
chkListBox.SetItemCheckState(index, CheckState. ...);
|
|
|
|
|
Dear All,
I am developing a desktop application in C#. My client right now is using
Excel to create their data sheet. In excel we can use drag and drop functionlity
(Entering data in one row and pasting it by dragging to multiple rows). I want
to implement same functionality in DataGridView. Any clue to do this.
Any help will be appreciated.
Regards,
Lalit Ahuja
|
|
|
|
|
hi
it is my Code :
DataTable dt = new DataTable();foreach (DataGridViewRow _gridViewRow in dataGridView1.Rows)
{
if (_gridViewRow.Cells[0].Value != null && _gridViewRow.Cells[0].Value.ToString() == "True")
dt.ImportRow(ds_zamin1.Khaneh_1.Rows[_gridViewRow.Index]);
}
this.dataGridView1.DataSource = dt; // dt is global viriable
but when i execute this method,nothing occured,only myDatagridView show some blank row(s).
how to solve problem ?
|
|
|
|
|
Someone recently asked exactly the same question... I think on the next page...
Read the forum and search for your item before posting a new question...
- - - --[ i love it when a plan comes together ]-- - - -
|
|
|
|
|
Hi,
I need to pass additional info about created component from Addin to form designer. I have written custom service MyService which implements IMyService interface. I add this service by AddService method of active window's DesignerHost object. When i try to retrive it from form's desigher class,
IMyService ms = (IMyService)GetService(typeof(IMyService))) ,
it makes an error like "Cannot cast objet of type MyService to IMyService"
Thanks for help
|
|
|
|
|
hi,
in my application i have a listview with populated data. when i select a row i get my results but as soon as i want to select any other row i get the following error:
InvalidArgument=Value of '0' is not valid for 'index'.
Parameter name: index
here is my code:
<br />
private void listviewAcc_SelectedIndexChanged(object sender, EventArgs e)<br />
{<br />
_DataValues.AccountName = listviewAcc.SelectedItems[0].Text.ToString();<br />
}<br />
no matter what i change the index to it will give me the same error. this only works the first time i selected a record but as soon as i make a second selection i get this error
pls help
thanks
regards
|
|
|
|
|
I had this problem too. When I debugged it, I noticed that it was calling my event handler twice if I changed from one selected item to another, but only once if I had nothing selected and I clicked one. This makes sense because when the selection changes from one item to another, it has to deselect the current item, which fires the 'Changed' event, and then it selects the new item, firing the event again.
The first time the event gets called, there is no selection (SelectedItems has a size of 0), so you will get an InvalidArgument or possibly the "Object reference not set to an instance of an object" error. All you need to do is add a check to see if any items are selected. You can do that by examining the Count property of SelectedItems.
"Quality Software since 1983!" http://www.smoothjazzy.com/ - see the "Programming" section for (freeware) JazzySiteMaps, a simple application to generate .Net and Google-style sitemaps!
|
|
|
|
|
Hello,
I'd like to run an application in a remote computer, but without client/server structure, for example using the class Process in the remote computer.
Thanks
|
|
|
|
|
You and every virus writer on the planet.
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hello,
Can any body provide me with custom explorer sample project just like the one used by windows... want to have that to save some time...
Thanks.
Regards.
|
|
|
|
|
I put "C# custom explorer sample project" into Google and found this:
http://www.codeproject.com/useritems/ExplorerTree.asp[^]
Usually when you do your Google queries for this kind of thing, if you put the language or technology you want to use, it will come back with pretty good responses. This was the third result, and I think it should answer your question.
"Quality Software since 1983!" http://www.smoothjazzy.com/ - see the "Programming" section for (freeware) JazzySiteMaps, a simple application to generate .Net and Google-style sitemaps!
|
|
|
|
|
Here's another one: C# File Browser[^]
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi sir,
I wrote a app.config as follows
<appsettings>
<add name="dbConnection"
="" connectionstring="data source=MANGALA;initial catalog=Northwind;persist security info=False;user id=sa;pwd=sa;workstation id=MANGALA;packet size=4096" providername="System.Data.SqlClient">
I called that connection string like this,
SqlConnection cn;
sConn = System.Configuration.ConfigurationManager.AppSettings("dbconnection");
cn = new SqlConnection(sConn);
cn.Open();
then it is an error :
The type or namespace name 'ConfigurationManager' does not exist in the class or namespace 'System.Configuration' (are you missing an assembly reference?)
I am a beginner for c# can you help me?
thank you
|
|
|
|
|
Collapse your project in the Solution Explorer window and right click 'References' and choose 'Add Reference'.
A popup window appears, on the .NET tab, choose System.Configuration and press the OK button.
Try rebuilding your project
- - - --[ i love it when a plan comes together ]-- - - -
|
|
|
|
|
Hi
I tried that, but there is no just System.Configuration. it has System.Configuration.install.dll I add that. but same error is coming.
thanks
|
|
|
|
|
That means you already added it, and you just need the Using statement I mentioned.
"Quality Software since 1983!" http://www.smoothjazzy.com/ - see the "Programming" section for (freeware) JazzySiteMaps, a simple application to generate .Net and Google-style sitemaps!
|
|
|
|
|
mwith wrote: Hi sirs and madams,
(fixed that for ya)
You need to have:
using System.Configuration;
at the top of your code file. You might also need to explicitly add the reference to the System.Configuration assembly to your project. (Right-click on 'References' in the solution explorer, and click 'Add Reference...', then select the System.Configuration assembly, which is under the .Net tab in the window that pops up, and add that assembly to your project.)
You will need to add a name attribute to your config file entry, or the app can't tell what you mean by 'dbconnection'. I do it like this:
<appSettings>
<add key="dbconnection" value="myconnectionstringwhateveritis"/>
</appSettings>
Also, I hope you didn't just give us all your SA login info. You need to change that right away if you did.
"Quality Software since 1983!" http://www.smoothjazzy.com/ - see the "Programming" section for (freeware) JazzySiteMaps, a simple application to generate .Net and Google-style sitemaps!
|
|
|
|