|
Either the ToString method on your numbers will take a format specifier, or a String.Format can take a format specifier to state how many digits you want after the decimal point.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hey!
I have built a class that inherit from the Stream class, but i am not realy using any of the Streams members, can i still call my class a Stream class?
My stream class need one stream from the serial port, and one stream from the units within the program.
To get this i add two ArrayLists(BuffertFromPort and BuffertFromUnit) to my Stream class..
My ide of this stream class is to let every unit(that needs the stream) get access to this stream object(as with regular stream objects),
Unit Reading part
the stream object stores the units name and the reader position on the BuffertFromPort array.
The units use a event on the stream to know when data is added on the BuffertFromPort array.
When this event is fired the units is providing there unit name to the stream object, the stream object looks how much data the unit is behind and returns this data to the unit. Is also moves the reader position of the unit.
The stream is using FIFO(First in first out), this means that if all unit reader positions is past a particular elemtn in the array, then it will remove all data before this poition.
Unit writing part
Only one unit can write to the serial port at once, so the unit need to get promission by the stream, if there already is another writing unit then the other unit will have to wait until the writing unit leves the premission free.
also this will be using events to let the serial port know when data is sent from a unit inside the program.
Incoming data from serial port
When data comes on the serial port i use ReadExisting witch return a string, this string is parse to byt[] then it is added to the Arraylist in the my stream object. When i unit is reading it returns the byt[] on a particular element and then the unit is parsing it to string(or what ever) there is also a function to let my stream class handle the parsing from byt[] to string.
THE REAL QUESTION
1. Can i call my class a stream class despite i dont use any of the Strem members?
2. Am i doing this the wrong way?
3. I know that you can connect streams to particular controls, is there any way i can do this?
Best Regards
snowman
|
|
|
|
|
Can someone please help me wih parseing a simple text file using C#? What I want to do is parse the text file and then put the chars parsed into a database. How would I do this?! Please help!
-Geiste
YOU! Out of the gene pool!
|
|
|
|
|
It depends entirely on what you need to parse, and which bit you're stuck with. Do you know how to read in a text file ? Do you know anything about regular expressions ? Is your input text complex enough to demand the use of regex ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
To read a text file:
using System.IO;<br />
<br />
TextReader txtRdr = new StreamReader("date.txt");<br />
string line = tr.ReadLine();<br />
txtRdr.Close();
To enter the chars into a DB, it depends on the DB. And what exactly do u mean by "putting the chars parsed into a database"? Each row of a table would contain one character?
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thank you for your help thus far. Polis:
Polis Pilavas wrote:
To enter the chars into a DB, it depends on the DB. And what exactly do u mean by "putting the chars parsed into a database"? Each row of a table would contain one character?
I am entering the information into rows in a MS SQL DB. Each text file has 255 chars. Each value is a fixed length from eachother. (0,5) is one value. 6,12, is another vlaue. Etc, etc. There is no pattern. I assume I will have to use an array to get all the information to store?
Each value I select will also have a row. I dont know if I am giving enough information. So I will put this as simple and direct as possible.
Think of a spread sheet, Each coloum has a title to it. Below each title is a value (1-5). Each row is a diffrent time the information is assigned (I will need a ID for this). So each time I parse this text file I will be taking the information from the text file placing it in it's row and then pulling the now structured information into my application... Does that make sense? I am trying to give as much information as possible to help
-Paul
|
|
|
|
|
Hmm.... I am not sure I understand what you are trying to tell me Paul. Let's see:
geiste wrote:
am entering the information into rows in a MS SQL DB
By an MS SQL DB you mean SQL Server? MS Access? Because each database type has a different ADO.NET connection type. For instance, MS Access needs an OleDbConnection. For general info on how to access a database, and loop through a table's records and read their values have a look here[^].
For different database types and information on how to access them, a simple Google search for something like "C# ADO.NET" or "Ms Access C# ADO.NET" would return thousands of hits, so take your pick
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Thank ya, yes I am using SQL Server 2000. I will try your hints, anyother advice?
-Paul
|
|
|
|
|
Not really.
Hope things r bit clearer now
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Hi, this should be really easy, but I can't get it to work. What I want to do is to open a window and keep the focus on that window even if the user trys to set focus on the parent window. I have tried to use the Activate and Deactivate events of the two windows but I can't get it to work
/Regards Johan Hertz
|
|
|
|
|
I guess what you are after is to be able to create an instance of the new form as modal.
For example: You are trying to open Form2 from Form1 when clicking a button. At the button click event you would say:
Form2 myForm = new Form2();<br />
myForm.ShowDialog();
Regards,
Polis
Can you practice what you teach?
|
|
|
|
|
Hi everybody , i want to move my dialog when by pressing the mouse button on any area of my program how can i do this in C#?
in C++ it was too easy by overloading the OnLButtonDown()
void CYourDialog::OnLButtonDown(UINT nFlags, CPoint point)
{
CDialog::OnLButtonDown(nFlags, point);
PostMessage( WM_NCLBUTTONDOWN, HTCAPTION,MAKELPARAM(point.x, point.y));
}
But i can't find smth. similar to PostMessage
m0n0
|
|
|
|
|
|
I think that you can use API of Windows such as "release capture"\"setwindowslong" \"sendmessage"
|
|
|
|
|
Does anyone know how i can get an event fired when the user changes the window position of the Internet Explorer?
I'm slowly gettin crazy with this problem...
Thanks for any help!
|
|
|
|
|
I understand that by setting DrawMode to OwnerDrawFix and then override the DrawItem method, I should be able to recreate the header for each tabpage,
now the problem is the header of each tabpage seem to be a control, and Graphics.FillRectangle cant fill the whole tab header, what can i do to add custom controls to the header or to have total control over it?
Thank you for helping.
Elapid For The Win
|
|
|
|
|
Please have a look at my Custom Drawn Tab control article. And then let me know where you stuck up with problem.;)
Sreejith Nair
[ My Articles ]
|
|
|
|
|
hi
where can i find example of making animation of a mesh made in a 3ds max with bones so i can control easc bone alone
thanks for help
|
|
|
|
|
Dear all
i am working in a programme that can get and set desktop background, and i am using C# , and i dont know how to do this with it
i need help
thx
|
|
|
|
|
So what ur saying is you want to be able to change the wallpaper programmatically?
|
|
|
|
|
There's examples of this all over the web. A simple Google search comes with over 25,000 hits...
Google results...[^] take your pick.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I want to draw simple rectangle , how can i do this??
Is there smth. similar to "CPaintDC"(in C++)
m0n0
|
|
|
|
|
I hope....you're asking for C#
well all you have to do is to get a graphics object say naming it g
and then g.drawRectangle(....);
then dispose g
....I suggest to get to google and search for GDI+ programming...there are many cool tutorials!
GaMBiT---> aND ReVeNGe WiLL Be
|
|
|
|
|
|
Hi everybody , i have written program in C# , and compiled using "Release", but now i want to take my program to a computer where Studio.Net is not installed , should i copy any *.dll files with my program , or what should i do in order to run my program??
Regards
m0n0
|
|
|
|