|
You can specify a format in the ToString method of the numeric type.
i.e. an int:
int number = 2;
string numberString = number.ToString("00");
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
|
Hi.
I'm gonna send this byte "10010101" to serial port.
I know , I have to use SerialPort[^] component , but I don't know how I can send a byte to serial port.
Let's write a example :
We have a textbox, the user inserts "10010101" into the textbox and we have to send this byte to serial port.
Could you please guide me ?
Thanks in advance.
|
|
|
|
|
This should help.
Life is a stage and we are all actors!
|
|
|
|
|
Thanks. but it's not the ones that I've wanted.
|
|
|
|
|
Your problem might is not related with serial port-it's sample conversion issue.You could convert this string "10010101"
to byte using System.Convert class.
<br />
byte b=Convert.ToByte("10010101",2)<br />
2 is the base of the number.Now b should be 149 decimal.
Life is a stage and we are all actors!
|
|
|
|
|
I think you're right.
Thanks a lot, I'll test it.
|
|
|
|
|
Hi,
What is it that you actually want to know?
1) How to use the serial port class,
or
2) How to convert the string representation of a binary number to a byte.
[Edit] I see that another person correctly guessed what you wanted!
Alan.
|
|
|
|
|
Hi I DELPHİ7 also prepared a project that I have. NET in any language, I need to bring. NET ten, I know C # project DELPHİ7 de yapılmıştır.Ben this project platforms for example, C # How do I move on, okay, I know two programming languages are opposite to each other in a way, but do not ever Even a simple transformation is sufficient to me. I know I could tell? I'm waiting for help from me can get this mail?
ibrahimdemir26@gmail.com
Thanks ...
|
|
|
|
|
Sorry I don't understand any of your problem. Most of the words, yes, but the sentences are beyond me. Please try again.
Do not post your EMAIL address, unless you REALY like SPAM!
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Your question is incomprehensible. If you're asking how to convert a Delphi project to one of the .NET lanugages, you have to rewrite the project from scratch. There is no conversion tool as far as I know.
|
|
|
|
|
Hi,
I have a winform which checks for emails in outlook and downloads attachment (Excel sheet) and read/display the contents to the user. This is currently done on a button click event. Is it possible to do this task without the user having to click on the button.ie each time a new email arrives the application automatically downloads the attahment , reads/displays the contents to the user?
The button click code is like this
private void button1_Click(object sender, EventArgs e)
{
Class.DownloadAttachment();
Class.Process();
}
Thanks..
|
|
|
|
|
spankyleo123 wrote: Is it possible to do this task without the user having to click on the button.ie each time a new email arrives the application automatically downloads the attahment , reads/displays the contents to the user?
It is possible, but is it desirable?
Would you want your work to be continually interrupted? It would become very irritating and would almost certainly result in people not wanting to use your software.
spankyleo123 wrote: private void button1_Click(object sender, EventArgs e)
{
Class.DownloadAttachment();
Class.Process();
}
If DownloadAttachment() and Process() are static methods of a class called Class , your choice of 'Class' as a class name is a really, really bad idea.
Lastly you have posted quite a lot of question by now, this is good, don't stop posting, but in nearly all of your threads, that I have seen, you have been asked to put your code snippets in <pre></pre> tags, and you are still not doing so. Please use the tags to make your code more easily read.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks for your reply. I shall make a note of it every time I post some code snippets.
"Class" is just an example my actual Class is not named as "Class".
|
|
|
|
|
Hi , Is it possible to run the downloadAttachment method on a different thread , so that the users are not interrupted when the proces is runnin?
|
|
|
|
|
Hi,
I have an object that performe a security check before setting a property
Class Issue
string _status
string Status {
set {
if (Value == "urgent" && current.User.IsManager)
_status = "urgent"
else
throw exception
}
get { return _status}
}
The problem arise when I just need to fill the status property from data coming from the Database.
Is there any proper OO way to leave the business logic in the object while allowing at least the db layer to fill this proerty?
At the moment, I have a IssueManager that is responsible to execture CRUD methods on the DB on behalf of Issue.
Thanks
|
|
|
|
|
pierpaolo paparo wrote: Is there any proper OO way to leave the business logic in the object
Probably not the correct OO way to do it, we use a bool flag bLoading to short circuit this problem.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
What would be the proper OO way?
How do you use the bLoading bool flag?
Pierpaolo
|
|
|
|
|
Have a local bool bLoading default to true, when the constructor is completed set bLoading to false
In the status check put the following
if(bLoading){return;}
in the first line.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Have the IssueManager class create the Issue object by means of a constructor that doesn't do a security check. If, for whatever reason, that won't work for you, you could always default to using reflection to manually set the _status field after instantiating the object.
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
Hi,
This could be a viable solution
Thanks
|
|
|
|
|
No problem
Adam Maras | Software Developer
Microsoft Certified Professional Developer
|
|
|
|
|
Yeah, a constructor that only the DB code uses.
Or maybe in serialization/deserialization code.
|
|
|
|
|
sample code :
Hashtable h0 = new Hashtable();
h0.add(0,10);
Hashtable h1 = new Hashtable();
h1.add(0,h0);
h1.Remove(0);
Question:
do i need to get the h0,remove the items in h0,then remove the h0 from h1?or just remove the h0?
|
|
|
|
|
Hi,
no you don't need to dismantle an element that you want to remove from a collection.
BTW: you should consider using generic collections (such as Dictionary<T1,T2> ), available since .NET 2.0; they are faster and safer.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|