|
I know you already solved your problem, but I thought I would send you the link to an article I wrote on this subject. It is pretty basic using simple tools. It sounds like the icon create you have may be the better thing to use.
http://www.codeproject.com/useritems/HowToIcon.asp[^]
Ben
|
|
|
|
|
how can i sort array in vb
|
|
|
|
|
Easy way to answer Ur question:
For i=0 To N-1
For j=i+1 To N
if Array[i]< Array[j] , then Swap the elements Array[i] and Array[j]
Next j
Next i
N-> Index of Last element.
Regards,
Arun Kumar.A
|
|
|
|
|
Why rewrite what the framework already offers ?
This is a bubble sort, it's quite slow.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: This is a bubble sort, it's quite slow.
I think this is selection sort.
Bubble sort would be: (in C Language)
for(i=1;i<n;i++)
{
for(j=0;j<n-i;j++)
{
if(a[j]<a[j+1])
{
swap a[j] and a[j+1];
}
}
}
Christian Graus wrote: it's quite slow.
Yes, it is the slowest sort.QUICK sort will be the most quickest.
Regards,
Arun Kumar.A
|
|
|
|
|
Arun.Immanuel wrote: QUICK sort will be the most quickest.
I'm not sure, I think it just has the best marketing team :P
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You can also take advantage of the sort method found in the Array class. Just pass your array to Array.Sort. The method is overloaded and can take a number of different parameters.
|
|
|
|
|
I have a vb.net 2005 form that calls up another form to add or edit a record in an Access 2003 DB. All that is on this add/edit form is labels and text boxes. I have a primary key and when I add a record it works just fine, but when I try to edit a record I get the following error....
"Update requires a valid UpdateCommand when passed DataRow collection with modified rows."
Here is the code that I am using, I have stepped through the code and everything seems to be functioning just fine right up until I get to the Update line below, that is where I get the error.
Me.Validate()
Me.SurgeonsBindingSource.EndEdit()
Me.SurgeonsTableAdapter.Update(Me.AnesDataSet.Surgeons)
Can anyone help me track this down? I am really at a loss. I bet it is something easy but I just can't seem to figure it out. Thanks for any help that you can give!
|
|
|
|
|
Once you give the SELECT command to the DataAdapter, you can use an OleDbCommandBuilder[^] class to automatically generate the INSERT, DELETE, and UPDATE sql commands for the DataAdapter. These are all necessary if you want to do anyn updating of the database from the DataSet/DataTable you filled with the Adapter.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
|
If you're using a DataAdapter and doing updates back to the database through that Adapter, there is no choice. You MUST provide the other SQL commands, either by using the CommandBuilder, or by supplying them yourself.
If you're not calling update on the Adatper, then you don't need the other commands. There is simply no getting around this if you use an Adapter.
There are, of course, other ways to fill a dataset and writing data back to a database without using a DataSet.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hey Dave, thanks for you input on this. I am probably not explaining things correctly so I will try to do better. This function that I am using works on on less than 18 other tables in my project with no problems.
Here's an example of what I am doing in a working function...
If txtDrugUse.Text = "" Then<br />
EditRow.SurgDrugDesc = String.Empty<br />
Else : EditRow.SurgDrugDesc = Me.txtDrugUse.Text<br />
End If<br />
<br />
<br />
'Update the record<br />
Try<br />
Me.Validate()<br />
Me.Pat01SurgeryBindingSource.EndEdit()<br />
Me.Pat01SurgeryTableAdapter.Update(Me.AnesDataSet.Pat01Surgery)<br />
Catch ex As Exception<br />
MsgBox("Update of Surgury Table Failed")<br />
End Try
Now I that have this working just fine all over my project and that is why I don't understand why I suddenly need to use a CommandBuilder to do the same exact thing that works everywhere else. Any ideas?
One thing that I have noticed, and I don't know if it has anything to do with it or not. but when I type in Me.Validate it takes it but from the drop down list that comes up it isn't listed but ValidateChildren is listed. I don't understand why and it might not have anything to with it but I am completely at a loss here.
|
|
|
|
|
Did you use the Designer to add these tables to your code?? It sure looks like it. In that case, the CommandBuilders have been put into your code automatically by the designer.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Yes I did. I created the Dataset and then I drug the needed tables to the designer.
|
|
|
|
|
Hi All,
I have the application developed in MS Dos Basic 3.0.
I want to convert or reverse engineering that application into .Net 2005 C#.
Kindly provide me suggestion or ways (any kind of parser is available).
thanks in advance.
Mack
|
|
|
|
|
The only choice you have is to analyze the source code of the app and completely rewrite it from scratch. There is NOTHING that will convert old DOS Basic code to anything in use today.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Thank you Dave...
Makarand More
|
|
|
|
|
I've been writing a bunch of little apps exploring various controls, components, etc.I have two minor issues, wondering if anyone could help.
First, when I build the apps to run outside of vb express, they all seem to require internet access to run.If I don't create an exception in my firewall for each app they crash on execution.
Second, When using the FileSystemWatcher object, if I save a file from the internet to the watched directory, I get double File Created events.Is this normal?
Eric.
|
|
|
|
|
Emetz564 wrote: First, when I build the apps to run outside of vb express, they all seem to require internet access to run.If I don't create an exception in my firewall for each app they crash on execution.
Don't know what this is. You don't need internet access to run the app. It would probably depend on what controls you're using.
Emetz564 wrote: cond, When using the FileSystemWatcher object, if I save a file from the internet to the watched directory, I get double File Created events.Is this normal?
Yes, it is. The FSW depends entirely on HOW the application is doing the file work. In the case if IE, when it downloads a file, it's downloaded to a temp folder using a temp name, not the real filename. When the download is done, the file is copied to the actual destination folder (Creat event #1), then renamed to its real filename (Create event #2).
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Thanks for answering.
Regarding question #1:
The apps in question aren't using any network or internet related controls.Just your basic combination of buttons,text boxes, notifyicon, etc.I guess I'll try a network sniffer and see what they're doing.
Regarding question #2:
If the FSW is only watching the destination folder, shouldn't the file created event in the temp folder be ignored?
Eric.
|
|
|
|
|
Emetz564 wrote: I guess I'll try a network sniffer and see what they're doing.
That would be my next move.
Emetz564 wrote: If the FSW is only watching the destination folder, shouldn't the file created event in the temp folder be ignored?
It is being ignored. The FSW only watches the target folder. When it starts, it enumerates the files and their Created and Modified DateTimes, along with other things. Every once in a while it makes another list and compares the two.
When a new filename shows up or a file with the same name has a new Created time, it fires off the Create event.
If a file disappears off the list, Deleted event.
If a file has a new Modified DateTime, the Changed event.
Now, Renamed is a bit different. The FSW CAN detect a renamed file, but, for some reason, not in all cases. It depends on what the application is doing that is modifying the files. Either the Renamed event is going to fire, or the Created event will fire, maybe along with the Deleted event. It probably has to do with a timing issue when the FSW scans the target folder(s).
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Hey all, I'm kind of new to VB so be gentle with me.
I'm trying to write an application that detects a mouse click on a video (target acquisition), working with still pics (jpeg etc.) worked great
but when I play a video (using MMcontrol) the clicks are not detected.
I'm using VB6 (thats what the U offers) and directx9 (on XPsp2)
Thanx in advance , have fun ya all.
|
|
|
|
|
I haven't used the MMControl in, what, 8 years. But, IIRC, it doesn't give any Click events for the video window, just the control bar.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Well thanks.
what i really need is a way to detect a click on the video, I don't care which
controller I use, if there is anything taht can make it work I'll take it.
thanks again.
|
|
|
|
|
Well, I don't know if it's possible, because I just about never touch DirectX, but if you have the capability to tell DirectX which window to draw in, you can use a PictureBox control as the target window, then handle the Click event of the PictureBox.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|