how to disable past date in calendar extendar in asp.net? [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to know how to disable pasts date in calendar extender in asp.net Code behind. I want to do it code behind without using java scripts.

You can set the StartDate property:
protected void Page_Load(object sender, EventArgs e)
{
CalendarExtender1.StartDate = DateTime.Today;
}
http://www.advancesharp.com/blog/1002/disable-dates-in-ajax-calendarextender

Try to add this on page load:
Calendar1.StartDate = DateTime.Now;

The solution was a matter of search far from your end. Anyways here is the total solution
ASPX
<asp:CalendarExtenderID="Calendar1"runat="server"
Enabled="True" TargetControlID="TextBox1"Format="dd/MM/yyyy" ></asp:CalendarExtender>
CS
protected void Page_Load(object sender, EventArgs e)
{
Calendar1.StartDate = DateTime.Now; //to disable past Date
}
Documentation on Datetime:- https://msdn.microsoft.com/en-us/library/system.datetime(v=vs.110).aspx
Hope that helps you

Related

Understanding the parameters of a functions provided through manual [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I am working on a Laser system. The system comes with it's own manual, including an SDK reference, but I need help on understanding the definition of a function included in the reference:
and
To use this function, I have this code:
private void BrightnessButton_Click(object sender, EventArgs e)
{
Double setBrightness;
laser.setDispBrightness(out setBrightness);
}
But it keeps giving me this error:
may not be passed with the 'out keyboard'" << I think you meant 'keyword'
They also provided me with the sample code below:
How can I make this work? Any help in understanding how to program just simply the brightness would be appreciated. I am having trouble understanding what to put in for the parameters. Thanks
Only use an out variable when calling the get versions of the function. When calling the set versions of the function, you should have already set a value for the variable:
private void BrightnessButton_Click(object sender, EventArgs e)
{
Double setBrightness = .5; // set to 50%
laser.setDispBrightness(setBrightness);
}

C# How to pause program [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have simple question. How do I pause program? I want to change pictures very slowly.
My code:
private void button2_Click(object sender, EventArgs e){
Image picture1 = Program.Properties.Resources.picture1;
Image picture2 = Program.Properties.Resources.picture2;
Button1.Image = picture1
//Here I want pause
Button1.Image = picture2
}
If you want procedural code (like in your example), without timers and without locking the UI:
await Task.Delay(1000)
You can use Threads or Timers.
http://msdn.microsoft.com/en-us/library/swx5easy.aspx
http://programmingbaba.com/how-to-stop-system-threading-timer-in-c-do-net/
Or you can use Sleep method to puase your program.
http://www.dotnetperls.com/sleep

DataGridView need guidance with that [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Thank you for your time in advance, I need some help, I want to create a DataGridView in Windows form, and in this grid I want to enter data and when I hit enter it should save that data to database and create another line, I tried to find a good tutorial on it but didn’t succeeded. if there is any good example please let me know
And please I do NOT need the grid with save update etc buttons, It should save data upon hit enter and cursor moves to the next line of the grid
If there is any tutorial or example please let me know
You simply catch the Enter-key in the DataGridView.KeyDown event:
private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
yourSaveRoutine();
dataGridView1.Rows.Add();
}
}

Call a class in Visual studio through a button [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
i have this project in my visual studio and i have a form which is linked to a solution in a project.
So, i need to call it on a button click.
It's like:
private void button1_Click(object sender, EventArgs e)
{
poComp.Client.StartpoComp
}
The thing is i have not copied the code the right way, houw should it proceed?
What is the file's structure?
Sorry, i know this might sound dumb and it probably is but i'm right in the beginning.
Below will do what (I think) you want to do but I strongly advise that you google "using classes c#" to try and find some tutorials
Here is just one
private void button1_Click(object sender, EventArgs e)
{
StartpoComp spc = new poComp.Client.StartpoComp();
//myFormsLabel.Text = spc.SomePublicVariable;
//spc.SomePublicMethod(param1);
}

Calculating the average time between button clicks [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I'm doing this Windows Forms application in C# so when you click this button multiple times, it calculates the average clicks per second you do.
I just yesterday started learning C# and the only language im good at is Lua. In Lua this would be simple, just use a table as they're very dynamic and flexible. I just have no clue how to do this in C#, the MSDN Articles just confuse me.
How would I store the times between clicks? Arrays? I have no clue. This is the button click function I have so far
private void button1_Click(object sender, EventArgs e)
{
//DO STUFF
}
You could store the time of each click, then compute the average of the times between them:
private List<DateTime> clickTimes = new List<DateTime>();
private void button1_Click(object sender, EventArgs e)
{
this.clickTimes.Add(DateTime.Now);
if (this.clickTimes.Count > 2)
{
double averageSeconds = this.clickTimes.Zip(this.clickTimes.Skip(1), (a,b) => (b-a).TotalSeconds)).Average();
// Do something with the average seconds between each click here
}
}

Categories