Hello again,

How can I count the message size from:

msg.Body = tbText.Text;

?
I need to get KBs.

Well, if we assume each character is a byte (generally) then you can use tbText.Text.Length to get the total number of characters (bytes) contained in the text segment you're working with and convert from there.

Hope that helps :) Please remember to mark solved once your issue is resolved.

Oh, if it's so, than it's just a piece of a cake... thank you

Please remember that the character count and byte count are not the same.
The byte count will depend upon the text encoding (ASCII, UTF8 etc.).

commented: Darn you nice catch :P +1

if we assume each character is a byte (generally)

Which is why I said "if we assume" each character is a byte :) Correctly noted that different encoding produces different sizes and as such one should determine the size of each character unit prior to relying on my example.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.