|
|
They all say that the first time.
|
|
|
|
|
Sorry it appears the rtb wasn't wide enough for the text!!
Sorry!!!
Glenn
|
|
|
|
|
I'm pretty sure he didn't mean that. That would be silly.
glennPattonWork wrote: I'm using the ReadExisting()
I would more likely use Read(Byte[], Int32, Int32) , but ReadExisting should be OK unless you find it isn't (in the past I've had trouble with some communication equipment inserting NULLs that weren't sent by the device).
Anyway, once you have the incoming string, you can iterate the characters:
e.g. foreach ( char c in s ) ...
and only pass along the ones you need. Personally I would write a class that would do all this and fire events for incoming strings/lines:
0) Instantiate a StringBuilder
1) Loop until told to stop:
1.1) Read incoming data
1.2) Iterate the incoming data
1.2.1) If printing character (or TAB), append to StringBuilder
1.2.2) If Carriage Return, Raise event to send contents of StringBuilder, clear StringBuilder
You may want to look at my TelnetSocket[^] for a similar technique (I thought I had a Serial Port version too).
|
|
|
|
|
I had more of a look the problem appears to be in the save command, but I will have a look at TelnetSocket.
Thanks
|
|
|
|
|
Okay I appear to have solved my problem in a silly way.
I just made the rich text box wider! Looking back into the code I was taking out all the stuff that could cause this kind of grief I just made the box too thin to take a long reading....(hangs head in shame!!! )
Thanks
Glenn
|
|
|
|
|
Do you mean that the text was wrapping?
|
|
|
|
|
I think so, I had made the box wide enough for the longest reading and tried to trim out all non-essential character,but it looks like that was the problem. Ah well testing time today!
Glenn
|
|
|
|
|
Well, that's cured that problem WordWrap to False.
|
|
|
|
|
I need to create a routine that reads all the excel files saved from sql DB.
If I have 40 excel files in my DB. I need to extract all one at a time then read the content of the excel file, save it to a grid for reporting.
Excel is in standard template with only 4 columns.
Hope you could enlighten this.
Regards
Dabuskol
Dabsukol
|
|
|
|
|
dabuskol wrote: Hope you could enlighten this.
Open the Excel-file (using ADO.NET, or any other library), read the content in a loop, write it to a database. Grids aren't a storage-point, they're used for displaying.
What exactly do you need enlightenment with? How to read Excel, how to save it, or the complete task?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
excel files are saved in a database for every record created.
What I need is to read this files of every record let say 10 records per run then automatically read the content of each file to a grid for display purposes.
In the end all the contect of 10 excel files is displayed in the grid for viewing.
no human intervention, automatic with a single button.
Regards
Dabsukol
|
|
|
|
|
dabuskol wrote: What I need
Who is saving the Excel files, what database? Sql Server? Oracle? Sqlite? Are they saved as a BLOB, or is it a real import? Do you want to "show" 10 excel-files (and their content) in a single grid? How?
You'll have to formulate your question with a bit more detail to get a decent answer. And that's what we do, answer questions - that's a bit different from "providing codez". Like your question is standing now, I'm very inclined to explain how to add a button to the form.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
In a C# 2010 desktop/console appplication, I would to know how to accomplish my tasks (or at least part of my taks) listed below working with xml:
1. I want to parse out specific nodes so that I can access the various level of nodes I am working with.
2. I would like to place various data elements in a collection/array that I can work with like an array.
3. I would like to take the xml file and add certain sections to a sql server 2008 r2 database.
**Note: The xml contains the various kind of stuctures:
a. There is an occurence of 0 to 50 customer names.
b. There is a node is just unique elements.
c. There is an occurences of 0 to 25 elements that contain the
following 4 items in each occurence:
customer number, customber address, customer city state and zip,
contact name, contact number.
Thus can you tell me and/or point to to references that will show me how to accomplish my goals (or at least part of the goals)? If I have at least an example or two to look at, I can figure out how to accomplish the rest of the goals.
|
|
|
|
|
sc steinhayse wrote: 1. I want to parse out specific nodes so that I can access the various level of
nodes I am working with.
An easy way to do this is to use Linq for XML. Take a look at this[^].
sc steinhayse wrote: 2. I would like to place various data elements in a collection/array that I can
work with like an array.
Using XLinq this is trivial. Read up on it and see how you can use things like ToList() or ToArray() .
|
|
|
|
|
Can you show mne more code examples than the link you pointed to?
|
|
|
|
|
Sure. You can find examples of querying XML here[^]. If you were to post a simplified sample of the data structure you are talking about, I could show you a sample query or two that would mean more in the context of what you're trying to do.
|
|
|
|
|
I have a process to print my sql database Id in zebra printing machine with Barcode using c# i am confused i dint use zebra printing machine before . Help
BigHeart
|
|
|
|
|
Unsurprisingly, I was able to find a C# implementation of printing to this device with a simple Google search. Here's[^] one result. In future, you should really try to search Google before posting here because you are going to wait for an answer here.
|
|
|
|
|
I am writing a C# 2010 application where I am obtaining a response from a web service and placing the data into a string called XmlizedString listed below.
private string serializeXML(object objToSerialize)
{
String XmlizedString = null;
MemoryStream mStream = new MemoryStream();
XmlSerializer xs = new XmlSerializer(objToSerialize.GetType());
XmlTextWriter xmlTextWriter = new XmlTextWriter(mStream, Encoding.UTF8);
xs.Serialize(xmlTextWriter, objToSerialize);
mStream = (MemoryStream)xmlTextWriter.BaseStream;
XmlizedString = U8ByteArrayToString(mStream.ToArray());
private String U8ByteArrayToString(Byte[] characters)
{
UTF8Encoding encoding = new UTF8Encoding();
String conString = encoding.GetString(characters);
return (conString);
}
My next step is to place what I have in the field called XmlizedString
into one or two sql server 2008 database tables.
Thus my question is how would you parse out the data that is in the
XmlizedString? Would you save the data to a text file?
Basically can you tell me how you would take the XmlizedString data and
get the parts I need for the database? I do not want to keep calling the
web service.
|
|
|
|
|
Maybe load it into an XmlDocument, pull out the parts you want, and store them? Maybe?
|
|
|
|
|
Either load it into an XDocument for Linq transformations, or an XmlDocument for traditional manipulation. You can do either from a MemoryStream so you don't have to use the file system.
|
|
|
|
|
Can you show me some code examples?
|
|
|
|
|
I don't have any to hand, no. Searching should turn something up, however.
|
|
|
|
|
Normally when you talk to web services you get something called a "proxy dll". A sort of wrapper that represents the objects in the web service and can be used as a normal reference. Is the webservice returning a (string) field containing XML or are you talking about the response itself?
V.
|
|
|
|