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);
}
Related
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);
}
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
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 7 years ago.
Improve this question
I am doing a school project and i can´t figure out how to "hide" some text blocks when the toggle switch is on and the opposite? Developing a windows 8 app. Thanks and btw. How do you make a collection from multiple text blocks(XAML)?
private void ToggleSwitch_Toggled(object sender, RoutedEventArgs e)
{
}
Assuming your control structure is fairly flat, you can get by using the Tag property on the TextBox. In your XAML, put some distinct value in the Tag field for each TextBox you want to make toggle-able, like the word 'CanToggle'. Then you can do something like
private void ToggleSwitch_Toggled(object sender, RoutedEventArgs e)
{
foreach (Control currentControl in this.Children)
{
if (currentControl.Tag == "CanToggle")
currentControl.Visible = !currentControl.Visible;
}
}
If your control collection is not flat, then you'll have to figure out how to dig recursively through the collection of controls to locate all the TextBox that you want to toggle. This answer may help.
Visual Studio Main Menu - Edit - Outlining - Toggle All Outlining: Ctrl+M, Ctrl+L
Personally, I use Ctrl+M to "collapse to defininitions" more than anything else though.
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
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();
}
}