|
Sorry Sandeep, I deleted another post. Thank you.
|
|
|
|
|
Good evening everyone, I have a problem that crushes me. With my app developed in C #, everything works very except that I'm stuck somewhere and I try everything it does not work. Can someone show how to "call a function after the minute's number"? Using timer
|
|
|
|
|
Create a Timer instance, set it's Interval property to 60 * 1000 (it ticks in 1/1000th of a second intervals), and add a handler to the Tick event before you start the timer.
After one minute you will get a Tick event and your handler method will be exectuted.
A minute later the same will happen again.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Can you help me with the code ? Please
|
|
|
|
|
What part of it can't you do on your own?
You know how to create an instance of a Timer, I assume?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
Good. So do that.
And you know how to set a property of an instance, yes?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
Excellent!
And you know how to add an event handler, I'm sure?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
Open Visual Studio.
Immediately after you set the Interval property, type the name of your Timer instance, followed by ".Tick":
myTimer.Interval = 60 * 1000;
myTimer.Tick Press the Tab key. Intellisense will fill in the rest of the line, and create a Tick event handler for you, containing just a "not implemented" exception for you to replace with your code.
You've done that before, haven't you? It's pretty basic stuff!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
You're welcome!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
how will I take ownership in registry subkey... from other owner(TrustedInstaller) to Administrator's.
|
|
|
|
|
Google for "C# take ownership of registry key" for examples and start reading.
|
|
|
|
|
I have an array of string which is
string[] myarr = new[] { "a", "b", "c" };
Can you please help me how to get this result?
a
ab
abc
I tried this one but I just don't know how to get the value from the array and add it on my list
string[] myarray = new string[] { "a", "b", "c" };
List<string> resultarray = new List<string>();
int i, j;
for (i = 0; i <= myarray.Length; i++)
{
for (j = i; j <= i; j++)
{
}
}
|
|
|
|
|
A simple loop: print the first character, print the first and the second, ...
|
|
|
|
|
Member 13081065 wrote:
for (j = i; j <= i; j++) What values do you think j is going to take within that loop?
Try debugging your code and stepping through the loops. Do the values you see in the debugger match what you were expecting?
NB: You don't need an inner loop at all. String.Join[^] has an overload which lets you specify the range of elements from the array that you want to join. For example:
string[] input = { "0", "1", "2", "3" };
string output = string.Join(string.Empty, input, 0, 3);
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You get a value from an array by using an index - a numeric value that ruins from 0 to (N - 1), where N is the number of elements in the array. So valid indexes for your myarr array woudl be 0, 1, and 2.
If you want "a", then you use myarr[0]
If you want "b", then you use myarr[1]
If you want "c", then you use myarr[2]
That index value can be in a variable:
int index = 2;
Console.WriteLine(myarr[index]); Would print "c" for example.
Think about what your tutor wants you do to, and work out how you would do it manually - that may help you work out what your code needs to do!
Give it a try - this isn't complicated!
Hint: you only need one loop!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
string[] myarr = new[] { "a", "b", "c" };
string s = string.Join( "", myarr);
for ( int i = 1; i <= s.length; i++ ) {
Console.Writeline( s.Substring( 0, i ) );
}
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Hello, I am working on a project where I have to make connections with a smartwatch (Samsung gear s3) and a Unity application, then use the heart rate data in the Unity app. Any help is appreciated since I am experiencing problems making it work. Thank you in advance! ^^
|
|
|
|
|
|
Well the problem is that I have never worked before with creating connections of such kind and I don't even know where to begin with. I am currently looking for a client that could establish these connections but still do not know how...
|
|
|
|
|
My wallet is empty ... can you put some money in it? I'm having problems filling it.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
I suspect that one will make a loud whooshing noise as it flies quickly above him ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|