|
tinase leishtamesh be ASCI.
yahol lehiot she ze yazor leha:
TcpClient newClient;
byte[] bytes = new byte[1024];
ns = newClient.GetStream();
bytesRead = ns.Read(bytes, 0, bytes.Length);
message = Encoding.ASCII.GetString(bytes, 0, bytesRead);
|
|
|
|
|
The answer you provide might be valuable for a lot of people, so please, answer in English.
Regards,
Lev
|
|
|
|
|
Ok Did it help you?
Try to use ASCI code.
In the past i created chat(server and client) that get stream(text) from tcp connection and show it in textbox.
TcpClient newClient;
NetworkStream ns;
string message=" ";
byte[] bytes = new byte[1024];
ns = newClient.GetStream();
bytesRead = ns.Read(bytes, 0, bytes.Length);
message = Encoding.ASCII.GetString(bytes, 0, bytesRead);
|
|
|
|
|
Hi all
I am encrypting my password using md5 algo to store in sql server..
While retriving the password the esacpe sequence "\r" is replaced "\\r".
thus the 2 password doesnt match.
i tried to check for \\ at the rertival string and replace it with \ using string.replace also tried to resolve the problem using regex..
It doesnt work for me..
thx in advance.
|
|
|
|
|
After encrypt before saving to database,encode it in 64 bit and then save it.and do vice versa after retrieving from DB.By this you won't get this type of issue.When get resolved ,let me know too.
Cheers!!
Brij
|
|
|
|
|
Thx for the immediate solution ...
This has resolved my problem
Tejesh
|
|
|
|
|
k
Cheers!!
Brij
|
|
|
|
|
Hey everyone,
I have the following text block wrapped in one long line line
From: ilaria simeone <ilaria.simeone@libero.com>
To: <muammar_y@hotmail.com>
Subject: RE: Merry Christmas!
Date: Wed, 24 Dec 2008 18:59:29 +0100
What pattern do I need to get:
ilaria.simeone@libero.com
muammar_y@hotmail.com
RE: Merry Christmas!
Wed, 24 Dec 2008 18:59:29
Many thanks!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
This works for your case, but it might not with some other formats. You need to carefully test it:
From:.+<([^>]+)>\r?\n?.*<([^>]+)>\r?\n?Subject:\s+(.+)\r?\n?Date:\s+(.*?)\s[+-]\d\d\d\d
Apart from that, I strongly suggest you take a look at this book: Mastering Regular Expressions[^].
I read it and that's where I got my knowledge from. It's by far the best book about regex you can get.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks Greeeg!
Actually, I was about to ask you how to fish instead of asking for a fish each time
Many thanks Greeeg!
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Muammar© wrote: Actually, I was about to ask you how to fish instead of asking for a fish each time
Haha, this book will tell you how to fish
Of course you can still come back and ask if you have any questions - I'm not a regex guru myself, but my knowledge is enough for some of the simpler patterns.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
|
excellent answers are here[^].
Why do you repost? It will not help you, continue the existing thread if you have to.
|
|
|
|
|
Hello everyone,
I am writing the following program to send a message to my gmail box. There is no
exception, but I can not receive any email in my gmail inbox. Does anyone have any ideas
why?
MailMessage mailMsg = new MailMessage();
mailMsg.From = new MailAddress("youremail@example.com");
mailMsg.To.Add("someone@example.com");
mailMsg.Subject = "Test subject 2";
mailMsg.IsBodyHtml = true;
mailMsg.BodyEncoding = Encoding.UTF8;
mailMsg.Body = "This email is sent from asp.net code";
mailMsg.Priority = MailPriority.Normal;
SmtpClient client = new SmtpClient();
client.Credentials = new NetworkCredential("myemailaccount@gmail.com",
"mypassword");
client.Port = 587;
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
object userState = mailMsg;
try
{
client.Send(mailMsg);
}
catch (SmtpException ex)
{
Console.WriteLine(ex.ToString());
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
return;
thanks in advance,
George
|
|
|
|
|
|
Cool, thanks Tamer!
Looks the site is not free?
regards,
George
|
|
|
|
|
how to insert unicode into wordpad using c# app working in background?
while typing text in wordpad and would like to insert a "circumflex".
example: when type a letter "A" in wordpad and would like to add a "circumflex onto "A" from c# app that working in background.
|
|
|
|
|
Why do you need unicode to send 'circumflex'?
You need the window handle of the texbox inside the instance of notepad that is running, then you can send it window messages. AKA, an ugly hack.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I have a gridview with users list. When I double click a row it opens a new tab with a new gridview, fetching data that does belong to that user from another table. Question is, how can I and create a connected database gridview with this selected data? I always done data task my way, using access layers and sprocs and I'd like to start learning connected/binded data operations.
Tables are like this:
Users UserRecords
--------- ------------
ID RecordId | UserId
The second gridview should be binded to rows from UserRecords with like UserId=1234...
I'd appreciate any info on this..
|
|
|
|
|
Hi i am back here with another problem that i am facing with C#. I am still a newbie to this language and i am having a problem with my current project.
Below is a screenshot of what my project looks like at current in VS2008:
What i need is to have the column headers dynamically change depending on what option the user will select to view (client, job, contractor etc) because at current the only way i can name the column headers is by manually naming them...
This would work for the first option (client) but when the user would click on say the (job) button to view jobs in the list it will still show the column header for (client).
I have looked over the internet and in my books and the only method they show for naming column headers is by using the gui way in vs2008.
Would a way to get around this be to have a listview class for each of the nav buttons i have (client, job, contractor etc) so when a user clicks, it calls a seperate listview (so there is actually 8 list views storred but only 1 called when a button is clicked?)
Thank you in advance.
c~Rose
modified on Friday, December 26, 2008 11:48 AM
|
|
|
|
|
cobalt-rose wrote: hat i need is to have the column headers dynamically change
You can first clear the listview from data and then remove oclumns. After that add the new columns you need. In order to do this, have a look at: ListView.Columns Property[^].
cobalt-rose wrote: Would a way to get around this be to have a listview class for each of the nav buttons i have
That's one way, but I think you're wasting resources if you have several listviews and you actually need only one at a time.
|
|
|
|
|
First create your columns (e.g. using VS GUI, but actually you can do it in code), then change the column header text like this:
listView1.Columns[0].Text = "Some header";
Regards,
Lev
|
|
|
|
|
Thanks for the advice...
I have managed to get my column headers displaying from using an array. But the problem that i now face is that when i click on my "clients" button in my app the data is pulled out but it is only displaying in the first column [see image link]
could you provide me with some tips?
My code:
private void client_buttonBox_Click(object sender, EventArgs e)
{
string[] colhead = { "Client_ID", "Company_Name", "Contact_Name", "Employee_Count" };
int p;
dataCategory = client;
// Create a ColumnHeader object
for (p = 0; p < colhead.Length; p++)
{
ColumnHeader header = new ColumnHeader();
// Set its text to be displayed
header.Text = (colhead[p]);
// Add it to the listview through its columns collection
listView1.Columns.Add(header);
}
string connectionString = "Data Source=localhost" + "; Database=deroche_consultants" + "; User ID=root" + "; Password=password;";
MySqlConnection MySqlConn = new MySqlConnection(connectionString);
string strSQL = ("SELECT company_id, contact_name, company_name, employee_count FROM client");
MySqlCommand mysqlCommand = new MySqlCommand(strSQL, MySqlConn);
MySqlDataReader Reader;
MySqlConn.Open();
Reader = mysqlCommand.ExecuteReader();
while (Reader.Read())
{
string thisrow = "";
for (int i= 0;i<reader.fieldcount;i++)>
thisrow+=Reader.GetValue(i).ToString() + ",";
listView1.Items.Add(thisrow);
}
MySqlConn.Close();
}
http://img.photobucket.com/albums/v678/cozboz/samecolumn.png[^]
[IMG]http://img.photobucket.com/albums/v678/cozboz/samecolumn.png[/IMG]
|
|
|
|
|
The first question is the listview empty when the user clicks the Clients button?
You should, probably, first clear the listview items and columns, then add new columns for the data you are loading.
In the data load code you are iterating through the rows and pushing all the columns of the reader into the first column of the listview.
Here is an example of populating a listview with several columns and data.
listView1.View = View.Details;
ColumnHeader col1 = new ColumnHeader();
col1.Text = "col1";
listView1.Columns.Add(col1);
ColumnHeader col2 = new ColumnHeader();
col2.Text = "col2";
listView1.Columns.Add(col2);
ListViewItem item = listView1.Items.Add("Hello");
item.SubItems.Add("world");
I'm sure you'll figure out the rest by yourself.
BTW, check out this link[^]
Regards,
Lev
|
|
|
|
|
Hey i have been advised to use a datagrid and have now managed to get the data displaying which im very happy with. Two questions though, is there a way to change the appearance of the datagrid as it looks pretty ugly compared to the listview also i am trying to get all data to display on a seperate form when a client is highlighted and i m confused as whether i can use the current dataset or have to create a new one. I have created a thread:
http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2861198[^]
Would really appreciate the advice
C~Rose
|
|
|
|