|
Actually I have to show 2 digit numbers at every 20 minutes in front end and save the numbers into database also. Eg: Show 6 different numbers at 10:00AM and save it, nest show another 6 different numbers at 10:20Am and save it, next......to till 8:00PM
Thanks
|
|
|
|
|
What they are trying to find out is what you have achieved so far. You have simply restated your requirements in a different format without showing what you have achieved so far - without this vital piece of information, it's difficult to assist you with the code because we could end up offering you advice that conflicts with whatever code you have in place right now.
More importantly, Code Project is not a place to come to have your code written for you; if you have some code and don't know or how why it's not working, or you have a query around an algorithm that you mostly have working, that's when the forums really come into their own. If you have shown no indication of the code in the first place, you'll end up getting short shrift I'm afraid.
|
|
|
|
|
|
How to convert variable name to string?
class SomeClass
{
public int SomeVariable;
};
string className = typeof(SomeClass).Name;
Чесноков
|
|
|
|
|
|
If you are using .NET 3 or above, you can use an expression tree to accomplish this. Here's an example of retrieving the field -
private static FieldInfo GetFieldInfo<T>(Expression<Func<T>> field)
{
FieldInfo fi = (field.Body as MemberExpression).Member as FieldInfo;
if (fi == null)
throw new ArgumentException("The field parameter should point to a valid field");
return fi;
}
|
|
|
|
|
That little snippet deserves T&T status.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Can't be done in general as:
- Values don't have names;
- Most objects don't have names (major exception is WinForm Controls, they have a Name property which is heavily used by Visual Designer);
- Variables have a name, obviously, inside the source file; the information is not preserved when compilation finishes. That is why Reflector uses mock names for everything that is a local variable.
Hoowever data members such as your SomeVariable do have meta-data inside the class, so you can use reflection to enumerate them, or obtain the value of a variable whose name you know at run-time.
Chesnokov Yuriy wrote: string className = typeof(SomeClass).Name;
is just silly.
Less typing is required to do string className = "SomeVariable";
I suggest you describe the real problem you are trying to solve, not a detail along the wrong path you seem to have chosen; and/or read up on reflection.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Luc Pattyn wrote: I suggest you describe the real problem you are trying to solve, not a detail
along the wrong path you seem to have chosen; and/or read up on
reflection.
It is in the question, given class variable as input convert it to string:
string name = FieldToString(SomeClass.SomeVariable);
Чесноков
|
|
|
|
|
Use reflection. I.e. PropertyInfo.Name for the variable names.
|
|
|
|
|
Are you looking into the classic infoof[^] problem?
|
|
|
|
|
Hi
In my application I allow for users to upload documents to a server via a web service. I recently created a progress form to show the progress of the documents being uploaded by incrementing a progressbar and updating some labels. However, the progress bar increments are equal to the size of the current document, so it updates in blocks. Is there any way to get the current byte or kilobyte being uploaded and increment the progress bar with that to create a better looking progress bar that continuously updates?
|
|
|
|
|
if you upload by sending chunks of data, then yes you could use the exact number of bytes transferred so far.
OTOH if your upload is a single action with no progress reporting, then you don't really know; you could still use a timer to have the progress bar advance corresponding to the amount of bytes in that upload, based on an assumed upload rate, which you could derive from the uploads done before, so only the first upload would have a jerky progress, and even that could be remedied by starting with either a historic upload rate, or a reasonable first estimate.
So it all depends on how you upload things. Since you asked, I expect you'd be in the latter category.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
how to use split container in c#
|
|
|
|
|
|
It is pretty simple: It acts like two panels with a moveable bar in the middle.
1) Drag a split container from the tool box onto your form.
2) Set the Orientation property to Horizontal if you want two panels above and below instead of left and right.
3) Drag controls from the toolbox over the left and right (or top and bottom) panel until the outline of the panel appears.
4) Drop the control on the appropriate panel.
Simples!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
|
Do you mean how to differentiate between the rwo split areas?
(I think others are just being mean at your expense!).
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
I wasn't being mean!
Beginner question => beginner answer!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Dalek Dave wrote: Do you mean how to differentiate between the rwo split areas?
That might be, but it's not what he's asking. If you want to know how to operate the breaks, the question "how do you drive a car" is too general. You're putting more effort in answering than the TS put into asking.
Dalek Dave wrote: I think others are just being mean at your expense!
I didn't see any post that said "RTFM"
I are Troll
|
|
|
|
|
Eddy Vluggen wrote: If you want to know how to operate the breaks, the question "how do you drive a car" is too general
not only too general but completely off topic. Are you suggesting that the OP doesn't want to know anything about split containers?
Your example perhaps should use the question: "How do you manage resting your staff members?"
I may or may not be responsible for my own actions
|
|
|
|
|
musefan wrote: not only too general but completely off topic.
Whehe, you're right, 'tis a lousy comparison
musefan wrote: Are you suggesting that the OP doesn't want to know anything about split containers?
I refuse to answer that one without my lawyer.
I are Troll
|
|
|
|
|
Dalek Dave wrote: (I think others are just being mean at your expense!).
I don't think so. Some people have even answered when they could have ingored him (as I have), so I guess he can still be grateful for the attention.
|
|
|
|
|
this Link[^] might help you.
I am also suggest you to navigate MSDN for details information. go there [^]
|
|
|
|
|
Hi
I created a form that acts as a progress indicator, including a progressbar and some labels etc. In the constructor of the progress form I register the delegate on the form that calls the progress form like so:
public ProgressForm()
{
SomeUserControl._updateProgressbarDelegate =
new SomeUserControl.UpdateProgressbarDelegate(this.UpdateProgress);
}
This approach however needs to be made more generic so that it can be called from various other UserControls and forms. I`m not sure what the best aproach would be to do this. I tried passing the calling form/usercontrol through to the constructor when creating an instance of the progress form, but how would I then know that updateProgressbarDelegate is actually a delegate in the form/usercontrol I just passed through? If I do something like this:
public ProgressForm(UserControl callingControl)
{
}
..then updateProgressbarDelegate will obviously not show up in intellisense when typing callingControl. because it doesn't know of what type callingControl is.
Could anyone please provide some help or hints?
|
|
|
|