|
Hi,
In my windows application, I have 2 treeview controls, say trvw1 and trvw2. I populate trvw1 from XML file. Selected nodes will be shifted to trvw2. When I select node1 after selecting node3 trvw2 appears as below.
trvw1 trvw2
------ ------
node1 node3
node11 node31
node12 node32
node2 node1
node21 node11
node3 node12
node31
node32
But in trvw2, node1 should appear above the node3 as it appears in the trvw1. The order of nodes should not get disturbed in trvw2 .
Could you help me to solve this problem. Thanks in advance..
modified on Wednesday, February 4, 2009 12:34 AM
|
|
|
|
|
Well, a horribly inefficient, but likewise easy method would be to use a BubbleSort, referring back to original TreeNode.
bool done = false;
int length = trvw2.Nodes.Count;
while(!done)
{
done = true;
for(int i = 1; i<length;> {
if(trvw1.Nodes.IndexOf(trvw2.Nodes[i])<trvw1.Nodes.IndexOf(trvw2.Nodes[i-1]))
{
done = false;
}
}
}
I would include the "NODE SWAP CODE," but I'm not anywhere that I can check syntax, so yeah.
Sorry if it doesn't work or if there are small errors - I'm working entirely off of memory.
EDIT: Fixed typos.
There is no knowledge that is not power. - Mortal Kombat
|
|
|
|
|
I'm working on a project for my Comp Sci class, so I figured I'd make a homebrew version of rock band/guitar hero, except with real instruments.
I was wondering if there is a way to capture the audio input in a stream, and then if there was a way to check the pitch of a particular point of that input stream.
Any help would be appreciated. Thanks.
There is no knowledge that is not power. - Mortal Kombat
|
|
|
|
|
Rock Band and Guitar Hero do not support real instruments.
You can capture the input, but I'm not sure how hard it is to work out a pitch, especially if it's a guitar, which can have vibrato, bent strings, whammy bar, etc.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Even capturing the input would be a good enough start from where I'm at.
I imagine I can learn how to manipulate the captured audio on my own - something about FFTs, I was reading. Makes me wanna play FF Tactics.
Is there any way I could convince you to post a link or snippet showing how to capture the audio?
There is no knowledge that is not power. - Mortal Kombat
|
|
|
|
|
|
Thanks, this should help a lot.
You must just be a a better searcher than I.
I'll let you see the finished project, if you want. Probably won't be done (to completion) until about late April though...
There is no knowledge that is not power. - Mortal Kombat
|
|
|
|
|
Hi, i have a application which have a button UPLOAD.
When i press upload, the code behind will create the URI, ftpwebrequest etc etc to establish a connection and does the method.fileupload.
How ever, the application hangs awhile it is being connected to the ftp server. when the connection done and finish uploading, then it unhang.
So issit possible to like when i click the UPLOAD button, it will print to a textbox saying "Uploading in progress.. please wait".
I tried adding this code
tbxoutput.Text = "Uploading in progress.. please wait" BEFORE the creating of URI etc etc. but it still hung..
Do i have to create a thread and put the creating in 1 thread and output text in another?
|
|
|
|
|
|
in the sample in msdn.
it has FtpState state = new FtpState();
but when i try this in my application, it does not seems to have ftpstate
|
|
|
|
|
FtpState is a sample class created in the same document. Scroll up or down and you will find it.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
i dont see any.. i scrol and up down ddint see any sample class
|
|
|
|
|
|
Hi,
Can someone please tell me how can I get the current ID from a table in SQL and incriment that number by 1 using a C# method?
The table looks like this:
Table: Person
Attribute: Id
Attribute: PersonId
Attribute: Person
The Id is auto generated by SQL. I would like C# to look what the current Id is and then incriment it by 1 when inserting the PersonId.
PS - If possible, can I do thisw in my C# code rather than SQL Stored Proc?
Illegal Operation
|
|
|
|
|
Well you would need to issue a Command to the db.
SqlCommand command ...
command.CommantText = "INSERT INTO customer (name, active) VALUES ('test', 1); SET @id=@SCOPE_IDENTITY();";
Would work
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
If you don't ask questions the answers won't stand in your way.
Most of this sig is for Google, not ego.
|
|
|
|
|
Illegal Operation wrote: The Id is auto generated by SQL. I would like C# to look what the current Id is and then incriment it by 1 when inserting the PersonId.
You said it does it by itself, AND you want to do it manually?
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Please help me that i need to generate an ID(number) with country code(string) while selecting countries from Combo box,i am using only one table with values Country,Id,Name...etc: with OleDBConnection ACCESS,i need number Id's for each country separately,please help me someone as i am a novice in coding
thanks in advance
|
|
|
|
|
Are you saying you want to stop SQL auto incrementing and instead do it yourself? Or, are you saying that you just want to find out what the ID of the previously inserted record was?
If the former, you need to be careful - as if multiple users access the db while you are doing your 'next number' calculation, t may end up trying to insert a duplicate value - much better to let SQL handle that for you.
To get the value of the last inserted identiy, use the SQL function SCOPE_IDENITY(). e.g.
Insert into Person (PersonId, Person) values (@PersonId, @Person);
Select SCOPE_IDENTITY();
then use
int newId = Convert.ToInt32(db.ExecuteScalar(dbCommand));
which will give your program back the ID just inserted.(I'm guessing here that your table has an Id column which is auto-incremented, and a PersonId column which is created somehow else.
(on re-reading this
Illegal Operation wrote: incriment it by 1 when inserting the PersonId.
I'm not sure what you mean by 'inserting the PersonId'?
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
its simple,
just create a query (or write a stored procedure which contains)
"select max(Id)+1 from Person"
or
if u want to increment in c#
just select the max(id) from table and
increment the variable by one to generate the new id
|
|
|
|
|
Did I understand correctly that you want to set personid to a number which is +1 from id?
If that's the case, the obvious question is why? However, you can do it for example like this when inserting:
insert into Person (Person) values ('....');
update Person set PersonId=Id+1 where id=SCOPE_IDENTITY()
|
|
|
|
|
I honestly didn't know such a thing existed until i came across it but I saw that it is possible to pull data from a web page in excel and then do whatever you want with it. Is there any way to do this in c#?
|
|
|
|
|
Take a look at the WebClient class and the Download* methods.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi to all!
I'm having a problem while trying to make gsm calls with my Westermo GDW-11 Modem. After making the first call to a number, i'm trying to make a call to another phone number. But i can't do it, because i can't hang up correctly. My DTR Line is always connected, even after using SerialPort dispose, setting DTREnable to false... and sending +++ and ATH commands to it... Anyone could help me with this? Is there any kind of documentation regarding the good way of making more than one gsm call sequentialy? My project deadline is approaching and this point is crutial.
Best regards.
|
|
|
|
|
I just found that WPF is great and it can make very smart tool, it is sth like HTML, is it easy to learn and use?
|
|
|
|
|
WPF uses XML markup, so the syntax reminds of HTML, but there the similarities pretty much end. It's the new version of windows forms, and it contains everything from the start that the old windows forms controls has been expanded with over the years. And then some...
I find it quite easy to learn and work with. The new model for layout makes it easy to do things that you before needed to stack panels into panels to be able to accomplish.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|