|
If I get you properly,
you can set checkbox Modifiers property to public, will allow you to access of checkbox control and its property.
Never unload your options form. just hide from user.
Thanks
Life's Like a mirror. Smile at it & it smiles back at you.- P Pilgrim
So Smile Please
|
|
|
|
|
Making controls of a form public is really a bad practice. We have properties and delegates to share data between the forms. One should make use of that.
|
|
|
|
|
You can make use of delegate and handle the check changed event for both the checkboxes in Creator.cs. In the event handler, assign the checked state values to a boolean variable. Then, you can use that in the Go button click event handler and proceed.
|
|
|
|
|
Ok so delegates seem to be the best option. These are completly new to me. How do I assign the boolean variable to a delegate and how to I pass it to Creator.cs?
Anything is useful, I'm having a look at delegate tutorials now.
Many Thanks again
|
|
|
|
|
Steve-Co wrote: How do I assign the boolean variable to a delegate and how to I pass it to Creator.cs?
You do not need to do this. You need to handle the check changed event of the checkboxes in Creator.cs. In the event handler, assign the check state to a boolean variable declared in the Creator.cs. Something like this:
class Creator{
public bool includeSubFolder = true;
private void CheckChangedEventHandlerMethod(object sender, CheckChangedEventArgs e){
CheckBox chk = sender as CheckBox;
if(chk != null){
includeSubFolder = chk.Checked;
}
}
} *
Steve-Co wrote: Anything is useful, I'm having a look at delegate tutorials now.
This[^] is what I found right now. It is for a web control, but the concept remains the same.
Hope it helps.
*Code might not work since I typed it right here and not in VS. Please bear.
|
|
|
|
|
You can
0) Pass the checkbox.Checked property values to the child form, or
1) Specify the child.Parent property to this from the parent form, or
2) Create a static class that holds the values of the parent checkbox.Checked properties and refer to that static object from both forms.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
...
3) Define a class to hold the configuration, create and pass an instance of it to the child, which can then set it as required.
|
|
|
|
|
Thank you all for your replies.
As I stated this was a simply problem and I choose to solve the easy way. Put the check boxes in Creator.cs rather than in a different cs.
One day i'll hopefully understand and implement properly. I understand this shouldn't be difficult. I just need to clear my understanding of OO.
Thank you all for your help
|
|
|
|
|
Dear all,
Currently, I'm finding the best sort algorithm for my case as below:
I already have 3 input arrays that are increment sorted by times (each array contains about 1,000,000 elements).
Now, I want to merge 3 arrays to one arrays (of course, it must be sorted).
Pls. support me to find the best way to do it, to improve performance as much as posible.
Thanks for your support!
|
|
|
|
|
Hi,
the best sorting algorithm for you're case is [Quicksort].
For you're 3 arrays:
A, B and C, you can merge A with B into D, then sort D.
Afther that, merge D with C into E, then sort E.
The final result will be the E array.
Cheer's,
Alex Manolescu
|
|
|
|
|
Thanks Alex,
Can you explain more detail?
Now, I'm undestanding: Quicksort is used for sorting D array after merge A & B.
1. If that's right, why don't we use merge sort to merge A&B to sorted D array?
2. If wrong, which algorithm you use when merge A&B?
|
|
|
|
|
Hi,
the example that i provided you is just an example. You can find many ways to sort an array.
For you're questions:
1. yes, you understand right! of course you can use merge sort if you wish, i've provided you just an example.
(another example: you can use quicksort to sort array A and B, then apply quicksort on D array!)
2. you can loop trough array A and B to fill the D array.
To see which algorithm is better try to set a timer at the start of the algorithm and at the end you'll see which is more faster
Cheer's,
Alex Manolescu
|
|
|
|
|
This[^] should help you choose one.
|
|
|
|
|
Do you actually need to sort them?
If the three arrays are already sorted and you just need to merge them then you could loop down them in parallel and copy the smallest value to the new array.
You need to increment the index for the copied value only and then loop around again.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
To find the best sort algorithm you must first get the value of each algorithm and then sort them...
|
|
|
|
|
Here's an implementation that does what I think you want.
Note: it uses Lists instead of Arrays. If you must use arrays then the output array must be big enough to hold all three input arrays.
Note: it relies on having a value (HIGH_VALUE) greater than any that can appear in any of the input arrays.
I've not done an analysis but don't think you can do it quicker. This goes through each array (List) only once. Any other approach probably needs multiple passes through the arrays.
using System;
using System.Collections.Generic;
namespace ConsoleApplication1
{
class Program
{
static List<int> listA = new List<int>();
static List<int> listB = new List<int>();
static List<int> listC = new List<int>();
static List<int> listOut = new List<int>();
static void Main(string[] args)
{
MakeSortedLists();
const int HIGH_VALUE = int.MaxValue;
int m = 0;
int i = 0;
int j = 0;
int k = 0;
int valueA = listA[0];
int valueB = listB[0];
int valueC = listC[0];
while ((valueA < HIGH_VALUE) || (valueB < HIGH_VALUE) || (valueC < HIGH_VALUE))
{
if ((valueA <= valueB) && (valueA <= valueC))
{
listOut.Add(listA[i]);
i++;
valueA = (i < listA.Count) ? listA[i] : HIGH_VALUE;
}
else
{
if ((valueB <= valueA) && (valueB <= valueC))
{
listOut.Add(listB[j]);
j++;
valueB = (j < listB.Count) ? listB[j] : HIGH_VALUE;
}
else
{
listOut.Add(listC[k]);
k++;
valueC = (k < listC.Count) ? listC[k] : HIGH_VALUE;
}
}
m++;
}
WriteOutList();
Console.ReadLine();
}
static void MakeSortedLists()
{
listA.Add(10);
listA.Add(11);
listA.Add(2);
listA.Add(1);
listA.Add(16);
listB.Add(5);
listB.Add(13);
listB.Add(7);
listC.Add(10);
listC.Add(6);
listC.Add(16);
listA.Sort();
listB.Sort();
listC.Sort();
}
static void WriteOutList()
{
Console.WriteLine("Posn Value");
Console.WriteLine("-------------");
for (int m = 0; m < listOut.Count; m++)
{
Console.WriteLine("{0,3} >> {1,4}", m, listOut[m]);
}
}
}
}
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
|
Hi, I would like to know if you can help me, I started working with Sharepoint about 2 weeks ago. Now, I work for a company that develops SP Sites etc. for other clients. I receiverd the task of creating an application with a user interface that backups what you choose to backup.
This must be a full on working application where you can choose the site, then subsites, custom web parts and custom master pages to backup. You must also be able to backup an entire site from the application.
I come from a web development background but have never worked with backups etc...so I have no clue where to begin.
I have spoken to my senior and he saiod that we would have to build everything from scratch and that we would not be able to use either the integrated Sharepoint.Administration.Backup or stsAdm.
Someone said I must look at the SPExport commands and to export the site as a template.
I cannot find sufficient info regarding backing up the site on the net as it is only the usual.
Have anyone done something like this before?
Please help
Jurie
|
|
|
|
|
I must build a program to solve 8-Puzzle with best first search algorithm , but i don't know how to do it.
You can build it in C# help me ( with source code)
Thanks!.
|
|
|
|
|
|
|
Im pretty sure its one of those 3x3 picture puzzles which has 8 parts to the image and you can slide one piece at a time into the epty square.
|
|
|
|
|
I generally see 4x4 with 15.
|
|
|
|
|
|
Dear all,
I got Timeout exception when reading from serial port.
how to overcome?
code:
// ports boudRate =115200, readtimeout=300 and writetimeout=300
private void btnRead_Click(object sender, EventArgs e)
{
OpenPort();
string str;
try
{
Thread.Sleep(1000);
str = _serialPort.ReadLine(); // exception occurs here
}
catch (Exception ex) { str = ex.Message; }
txtReadText.Text +=
string.Format("{0}{1}", "", str);
ClosePort();
}
|
|
|
|