|
first of all, thank you for your attention.
[SP] (space in ASCII)= means that there is space in line
[CR] (New row in ASCII)= means that there is a new row
for example this line:
I am going to show you something
i want to get:
I[SP]am[SP]going[SP]to[SP]show[SP]you[SP]something[CR]
while reading from the port,i get the information in one row. i want to separate and to know when a row is ends- [CR].
i know that there is method port.readline() but the application stucks on this line.
maybe there is another solution to know where the line is ends.
(i means, when i send two lines to the port from the first computer - on the second computer, i get 1 long row).
there is another way to solve it?
|
|
|
|
|
Hi,
Admin887 wrote: [SP] (space in ASCII)= means that there is space in line
[CR] (New row in ASCII)= means that there is a new row
That's what I assumed, but I needed to be sure.
If you are saying text is coming through correctly except for those two characters, then I admit
I know of no reason why spaces would not work as intended.
There are a few things you should be aware of:
1. serial ports transmit bytes, not characters.
2. .NET strings consist of characters, and Unicode characters at that (16-bit wide).
3. The SerialPort class translates characters to/from bytes using an Encoding; it has an Encoding
property for that purpose, it is said it defaults to ASCII, but IIRC it works better when you set
it explicitly, don't know why that is. And you might want to use code page 1252 so you get
8-bit ANSI characters (including some accented characters, trademark, copyright, euro, etc)
rather than just the 7-bit ASCII set
4. SerialPort.ReadLine() waits for an end-of-line, which is defined through the NewLine property.
AFAIK that is set to [CR][LF] by default (actually to Environment.NewLine). So as long as that
exact sequence of characters isn't seen, there is no new line starting.
5. Your sending program isn't really sending any NewLine sequences, is it? it is rather difficult
to enter them manually in a textbox. What you could do is transmit textbox.Text+Environment.NewLine
though.
Luc Pattyn [Forum Guidelines] [My Articles]
- 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 the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Friday, June 10, 2011 11:37 AM
|
|
|
|
|
Hi,
I suggest you add some logging to your sending application to determine what you actually writing to the port. You can then view the log file with a hexadecimal editor and assure yourself that you are sending the correct sequence of bytes.
If the file is as expected you could do something similar at the receiving end.
private void button1_Click(object sender, EventArgs e){
System.IO.File.AppendAllText("log.txt", textBox1.Text, port.Encoding);
port.Write(textBox1.Text);
}
Alan.
|
|
|
|
|
Hi,
I like that very much.
I would even add a label showing the hex values of the bytes that get transmitted at the sender,
and received at the receiver PC.
Observability is key in debugging.
Luc Pattyn [Forum Guidelines] [My Articles]
- 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 the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Friday, June 10, 2011 11:37 AM
|
|
|
|
|
Hi All
I have done a Sql database look up. I put the code on the button click event. I want it so that wen i type in something in the text box it will make sure there is text in the texbox before soearching. Becuase at the moment when i debug and click the button it will ust load every thing without men typing in it.
Here is my Code
//Find Button
private void FindButton_Click(object sender, RoutedEventArgs e)
{
var cmd =
new SqlCommand(
@"SELECT
b.EafGeobldID,
b.BuildingName
FROM
EafGeoZip z
inner join EafGeoBld b on z.EafGeoZipID = b.EafGeoZipID
WHERE ZIPCode LIKE '%" +
tbPostCode.Text + "%'");
var reader = Read(cmd);
if (!reader.HasRows) return;
while (reader.Read())
{
var item = new ItemObject
{
Key =
string.Format("{0}", reader.GetString(1)),
ValueOfKey = reader.GetInt64(0).ToString()
};
cbBuilding.Items.Add(item);
}
}
//TextBox
public void tbPostCode_TextChanged(object sender, TextChangedEventArgs e)
{
}
What do i have to do to accomplish this..
Thank You in advance
|
|
|
|
|
what a mess lol
if(string.isnullorempty(textbox1.text))
{
}
use system.data.sqlclient for the sql part
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
|
Genius!!! why didnt i think of that. If he types that then it will fix both his issues very quickly... maybe....
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
I have made a C# dll which will be consumed by a classic ASP web application. It is working fine when I tested it. Now I need to place it in a separate environment, where the ASP website resides, for another round of testing. Here comes the problem:
There is no .NET Framework in the machine where the dll should be placed. How should I go about it? One way that can think of is to create a setup project with .NET redistributable. Is there any other way to accomplish the task without installing .NET?
Apologies if this isn't the right place to ask this question.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
modified on Wednesday, February 4, 2009 8:40 AM
|
|
|
|
|
Maybe if you copied all the .dll files your .dll uses from the .Net framework to the machine with no .Net then maybe your .dll could reference the files directly? im not sure.
If this is possible thou, you would need to mod you .dll and there would prob be a fair few to copy from the .Net too so installing .Net would surely be the more sane route to take
.Net contains many components you obviously require, without the framework it would be like trying to pick the components out of thin air. you cant access what is not there afterall
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
Maybe you are correct, but I am afraid I didn't got your answer.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
I suggest stick with installing .Net framework on the desired machine. That way you will have less issues and it will be there for any other applications that may need it in the future.
I would go for the approach of including the redistributable
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
I need to be sure there is no other way. So far, THERE IS no other way.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
Like i said you cant use components that are not on the machine.
How does your asp app reference your .dll?
is it something along the lines of import("mylib.dll")? I cant remeber how you import libraries like that but what i was saying is you could try importing all the .Net dll's your dll requires and just copy them to the machine.
I do not know for sure this will work and also i dont know how you would find exactly all the .Net dll's you require
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
If you want to run the dll on whatever machine you will need the .NET Framework.
You can include the .NET redistributable by using a bootstrapper. This is all included with Visual Studio, you only have to change your project file a bit (found this also with google).
The WiX toolset is a good way to create MSI files with bootstrappers...
Regards
Sebastian
|
|
|
|
|
That is what came to my mind at first. I need framework to make the .Net dll interoperable with ASP. I want to be sure there is no other way. And I guess, so far, there is no other way.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
string pattern = "(-)|(#)|(/)|(&)|(\0)|( )";
string[] substring = Regex.Split(a[i], pattern);
input given is #55; xx road
but it returns many empty tokens inbetween the output... pls help me how to remove those empty entries
the quieter u become more u hear
|
|
|
|
|
|
What is the expected result?
|
|
|
|
|
input
#55; xx road
expected result is
token
#
55
;
xx
road
the quieter u become more u hear
|
|
|
|
|
i will place some control in tablelayoutpanel..when i select any control at runtime i need to show the selection handlers..
if any body don't understand my quesation check in design mode..like this..
Drag a tablelayoutpanel and place a control(any) and select that control..it shows the handlers to the control..i want show that's handler to my control..
or i need to show the selection handles to seleted cell in tablelayoutpanel
modified on Wednesday, February 4, 2009 10:44 AM
|
|
|
|
|
This is a design mode only feature.
only two letters away from being an asset
|
|
|
|
|
What do you mean, handler?
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|
|
In C# Visual Studio 2005, the control dateTimePicker can be editable manually with keyboard? I need this, but I dont find the way to do it. is it possible?
Thanks
|
|
|
|
|
Just to make sure, is this web or Windows? What do you mean "editable manually with keyboard"? You should be able to highlight the field and use the keyboard. Is the control disabled? What behavior are you getting?
only two letters away from being an asset
|
|
|
|