|
Seraphin wrote: Simple example:
[$0001][00]
[$0002][01]
[$0003][04]
[$0004][01]
[$0005][02]
Recursion - check element and its connectors
1. 0001 - my for loop checks all connectors -> Result: 0002 and 0004 (because Key is 01).
Just so I understand, you're starting with a value of (00)01 and asking which keys have this value? The result in this case being $0002 and $0004?
Seraphin wrote:
2. now check the connectors for connectors (we have 0002 and 0004)
3. 0002 has 0005(key = 02)
and so on .....
So having gotten the $0002 and $0004 keys, you are now interested in which keys have those two keys as values?
This suggestion may be exactly what Christian suggested, but I would switch things around and use the values as keys and the keys as values. Each key would have an array of values. It would look like this:
[00][$0001]
[01][$0002][$0004]
[04][$0003]
[02][$0005]
Asking the question again, which value(s) correspond to the 01 key? Answer: $0002 and $0004. Which value(s) correspond to the key 02? Answer: $0005 Which value(s) correspond to the key 04? Answer: $0003.
I'm a little confused on the differences in number formating, but I'm assuming that they are interchangable. At any rate, I'm probably missing something here, because this answer is too simple.
|
|
|
|
|
Hi Leslie,
Just so I understand, you're starting with a value of (00)01 and asking which keys have this value? The result in this case being $0002 and $0004?
Yes.
Christian suggestion leads into overhead within the recursion. It's impossible.
Try to make a recursion with 800 items, and you need about 10 min to loop through.
Yes, good idea ... but really time consuming (overhead)
The problem: Give me all connectors and subconnectors for current item. Lets draw better example:
$1 [0]
$2 [1]
$3 [1]
$4 [2]
Result:
a) $1 - $2 - $3 and
b) $1 - $3
for the first line
a) search connectors for $1 - found $2 and $3
then loop through founded subconnectors $2 and $3
$2 has $4 as connector
$3 has no further connectors
next element in main loop is §2
$2 - $4 .... $4 has no more connectors
|
|
|
|
|
Ok, I'm still mulling this over, but would it help if the values were sorted?
Say you have this:
$1 [0]
$2 [1]
$3 [2]
$4 [1]
$5 [2]
Then you sort them by values:
$1 [0]
$2 [1]
$4 [1]
$3 [2]
$5 [2]
What this buys you is that as soon as you encounter a value that doesn't equal the value you are currently searching with, you can stop the search for that value. And maybe even continue the search from that point for subconnectors.
Say you are searching with value [1]. You find the connectors $2 and $4. Then you encounter value [2]. You know at that point that you've found all of the connectors for [1].
However, did [1] have a connection to $2? Yes. So since you are already at [2], you can begin the search for $2's subconnectors from right where you are. Same goes for $4, which was also a connector for [1].
Does this help?
|
|
|
|
|
Thanks, looks better. Additionally I works with permutation now.
|
|
|
|
|
I have 10 Textboxes, textBox1 to textBox10
I have a string "naam" with contents textBox9. This 9 refers to the FOR-loop variable i
naam = "textBox" + Convert.ToString(i);
With the contents of de string-variable I would like to refer to the object with that name. I.e. textBox9.Text = ".....";
In this example I want to set de Text-property from textBox9 with the string naam
Problem: How can I refer to the name of the object textBox9 with the contents of the string naam?
Thanks
-- modified at 16:30 Sunday 20th November, 2005
|
|
|
|
|
if you just have 10 text box you can do it the long way with a switch case but it should work
ex:
<br />
switch(naam)<br />
{<br />
. case "textbox1":<br />
. TextBox1.Text="...";<br />
. break;<br />
. case "textbox2"<br />
.
}<br />
|
|
|
|
|
Let's say that you add textBox1 through textBox10 on your form. The TextBox.Name property has the string version of those stored if you use the visual form editor included in Visual Studio. So, to do what you want, if I understand your question properly, would be something like this:
int i = 9;
string naam = "textBox" + Convert.toString( i );
Control targetControl = null;
foreach( Control c in Controls )
{
if( c.Name == naam )
{
targetControl = c;
break;
}
}
if( targetControl != null )
{
}
"we must lose precision to make significant
statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
All right. Just what I meant. Works excellent. Thanks
|
|
|
|
|
My pleasure! Glad I could help you.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I want to convert a MFC application to C#. Please help with suggestions and/or tools?
|
|
|
|
|
You really can't convert it. No automatic way of doing this. If you want your app to be written in C#, you're really going to have to rewrite it using Windows Forms.
However, I'd question why you'd want to do this. .NET is not a rewrite strategy. Unless you have significant reasons for porting your app, don't do; it'd be a lot of manual work and undoubtedly would introduce many new bugs.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
As Judah Himango said, DOTNET is not really something you use just as a reason to roll out a V2 of your application.
If what you have in MFC works then keep it there.
If you want to add some new functionality then maybe you should keep it there.
If you want to add some new features that require the use of the managed code classes, or you want to really leverage the framework THEN consider a ground up re-write.
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|
|
I decided to rewrite the application.
For the UI conversion there is a tool RC Convertor from www.dudelabs.com but I cannot find any other tool which can convert my business logic code from C++ to C#.Will keep you all posted with my progress.
|
|
|
|
|
|
What's this?
'A programmer is just a tool which converts caffeine into code'
|
|
|
|
|
If you need to post code containing generics (using angle brackets), please the check the "ignore html tags in this message" checkbox before you post.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
I'm terribly sorry. I thought I didn't post the message...
Anyway, I answered the question I had myself.
|
|
|
|
|
I'm working to an application which use a DataBase (Access format *.mdb).
So i have a DataSet which contains a table of this DB and i want to represent it in a DataGrid...How ca i do it?
Thank You
Enrico
|
|
|
|
|
myDataGrid.DataSource = myDataSet.Tables["myTableName"];
or
myDataGrid.DataSource = myDataSet;<br />
myDataGrid.DataMember = "myTableName";
I hope you understand...because is a rough world out there...
|
|
|
|
|
hello!
i'm new here so please help me!
i'm doing a project...
i need to communicate from the computer to device whis RS232 cable
is there a class at the C# that takes care about communicating???
with not where i can found a class or someting like that???
waiting to your answers...
thank's
|
|
|
|
|
I belive the 2.0 framework has a class that allows you to talk to the serial ports. The 1.1 does not.
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
My Blog[^]
|
|
|
|
|
can you help me and search a class or something like that that i can use to communicate with the device???
|
|
|
|
|
djtourist wrote: can you help me and search a class or something like that that i can use to communicate with the device???
He did. He told you where a class was available. You just have to use Google or MSN Search to get the documentation on it. You can find it here System.IO.Ports namespace[^]
However, perhaps the pertinent words from your post are "I can use" - since you have not told us what you can use you were given the best answer available without that knowledge.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
hey thank's!
you help a lot
so actully there is a class that takes care of Serial Port!
and thank's again!
(-;
|
|
|
|
|
djtourist wrote: so actully there is a class that takes care of Serial Port!
Yes, and based on what Ray told you previously it took me less than 2 minutes to find the relevant document using MSN Search.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|