|
Am writing on genetic algorithm for nurse duty rostering and got hooked in my coding.can anyone send me samples in vb6.0 or java.for a period of one month or more.my email address is sopsophia@yahoo.com
Thanks
|
|
|
|
|
First, don't cross post. Second, your cross post in the Vista forum makes no sense. Third, if you are having problems post the code you have thus far, tell us the error and we will see if we can help you. Just asking for us to give you code is considered rude.
______________________
stuff + cats = awesome
|
|
|
|
|
Java is an academic language, because it is free. Genetic algorithms are academic playgrounds. If you search for Genetic Algorithm and Java, you will find many stable already complete and robust libraries.
Pualee
Edit: and they are free
|
|
|
|
|
For a movie project(in vb.net 2005), i have to store the availabilty of seat (100 checkboxes) in a textfile.According to the value of textfile like "True" or "false" ,i have to make the enable property of checkbox as enabled or disabled.The checkboxes are named as A1,A2,A3,..,A10
B1,B2..B10.Can anyone help me for this question ?
|
|
|
|
|
What kind of format is this textfile set up in? In other words, how are you determining whether the checkbox control should be enabled to true or false?
|
|
|
|
|
Thanks. The textfile is in the format of T;T;F;T;T;T;T;T;F;T .This pattern in ten rows. "T" stands for true (that is that seat is available for booking) and "f" for false .
|
|
|
|
|
Set up a counter to count the rows in your text file (this number should be incremented each time your text file goes to the next row when reading it)
Set up an index that will represent each seat when going through the row.
Loop through each row character by character, and have if statements checking whether its true or false
When looping, have if statements that will check the row count, and assign that to an alphabetic character representing your checkbox. ie. when rowcount is 1, it means A, 2, B, etc.
The index for each character will let you know which checkbox you are referring to. So if you're in rowcount 1, and your loop index is currently at 5 (i=5) or something, then you know you're dealing with control A5...once that is verified is just a simple call like A5.Enabled = True, or A5.Enabled = False, depending on if the character you are checking was T or F.
|
|
|
|
|
Thanks. Still i am not getting how i can retrieve the name of checkbox. How i get (name of checkbox).enabled.i have 100 checkboxes to change their enable property.I am stuck here .
My code is like this
Friend spider1Seat(9, 9) As String
Dim rowNames() As String = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J"}
Dim colNames() As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
Private Sub lstSessionTime_SelectedIndexChanged
Dim row As Integer
Dim col As Integer
Dim readArray() As String
row = .cboMovieName.SelectedIndex
col = .lstSessionTime.SelectedIndex
If row = 0 And col = 0 Then
seatReader = New StreamReader("Spider1Seat.txt")
Do While seatReader.Peek <> -1
readArray = Split(seatReader.ReadLine, ";")
For ctr2 As Integer = 0 To rownames.length-1
spider1Seat(ctr, ctr2) = readArray(ctr2)
If spider1Seat(ctr, ctr2) = "T" Then
End If
Next
ctr += 1
Loop
End If
|
|
|
|
|
Dim cb As CheckBox = CType(Me.Controls.Find("A1", True)(0), CheckBox)
cb.Checked = True
|
|
|
|
|
Thank you everyone.I got the logic form u people.It worked.
|
|
|
|
|
first you would have to read the text file
and for every line in the text file (wich I assumse corrisponds with the letter (line1=A, line2=B)) you dynamicly enable or disable the checkbox
this is how I did it (made a little example but can't attach it here so just the code then)
its only for 2 rows but should work fine for how many you want
(remember I made it in 5 min so there are things that could be better)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Dim fs As New System.IO.StreamReader("C:\Documents and Settings\Tom\Mijn documenten\test.txt")<br />
Dim rows As New List(Of String)<br />
rows.Add("A")<br />
rows.Add("B")<br />
Dim row As Integer = 0<br />
Do While Not fs.EndOfStream<br />
Dim s() As String = fs.ReadLine.Split(";")<br />
Dim column As Integer = 1<br />
Do While column < s.Length + 1<br />
enabledisableseat(rows.Item(row), column, IIf(s(column - 1).Equals("T"), True, False))<br />
column += 1<br />
Loop<br />
row += 1<br />
Loop<br />
End Sub<br />
<br />
Private Sub enabledisableseat(ByVal row As String, ByVal column As Integer, ByVal enable As Boolean)<br />
For Each c As Control In Me.Controls<br />
If c.GetType.Equals(GetType(CheckBox)) Then<br />
Dim chk As CheckBox = c<br />
If chk.Name.Equals(row & column) Then<br />
chk.Enabled = enable<br />
End If<br />
End If<br />
Next<br />
End Sub
I hope this helps you on your way
|
|
|
|
|
i have a CSV file, i want to import it into Access, i have tried that , and i saw the data, but the Icon does not appear as Table Icon in Access. when i drag the table created from an CSV file to my Vb.Net file.
i get a message that says "Failed to get Schemma for this Query" , that means i can use it in my vb project
help me
Vuyiswa
|
|
|
|
|
Vuyiswamb wrote: i have a CSV file, i want to import it into Access, i have tried that , and i saw the data,
OK. This is easy enough. File menu, Get External Data, Import...
Vuyiswamb wrote: but the Icon does not appear as Table Icon in Access.
You DID pick Import, didn't you?
Vuyiswamb wrote: when i drag the table created from an CSV file to my Vb.Net file.
You can NOT drag a table from inside the Access application to Visual Studio and expect it to work. So I don't understand what you did to get this message. In Visual Studio, did you create a new Data Connection to this .MDB file? Is this MDB file still open in Access?? If so, you have to close the database in Access before Visual Studio will be able to do anything with it.
|
|
|
|
|
Firstly i would like to thank you for your reply,
Vuyiswamb wrote:
i have a CSV file, i want to import it into Access, i have tried that , and i saw the data,
Dave Wrote
OK. This is easy enough. File menu, Get External Data, Import...
This one is Solved
Dave Wrote
You can NOT drag a table from inside the Access application to Visual Studio and expect it to work. So I don't understand what you did to get this message. In Visual Studio, did you create a new Data Connection to this .MDB file? Is this MDB file still open in Access?? If so, you have to close the database in Access before Visual Studio will be able to do anything with it.
Dave on this one i know i cant drag from Access to VS. i have to made a conncetion and when the tale appears in Server Explorer, then i can dreg it to the form. the first one Helped me a lot , thanks man you are Code Project Star:->
Vuyiswa
|
|
|
|
|
hello friends,
i am using flexgrid in vb6.0 in our project .its fine and good.In certain conditions i want to disable the flexgrid.
syntax:
grdreturns.enable=false
this means it disabled full flexgrid. But i am using scrollbars it also blocked i want to enable only scrollbars. how to do it give me a syntax.
plz give me a solution
thanks in advance
kankeyan
|
|
|
|
|
AFAIK, what you want isn't possible. The only way that could happen is if all the data the grid is showing is ReadOnly. I seem to remember something about the FlexGrid being ReadOnly if it's bound to a datasource.
My VB6 is so rusty, I'm thinking of just ignoring all those questions entirely.
|
|
|
|
|
Hi,
Just some questions that someone will find very easy.
1. For some strange reason when I put a breakpoint in my code (F9), the code does not stop. Why is this and how do I get it working again.
2. Is there breakpoint toggles as there was in VB6? If so how do you use them?
As I said before this is an easy answer for someone.
|
|
|
|
|
IS_Assessor wrote: 1. For some strange reason when I put a breakpoint in my code (F9), the code does not stop. Why is this and how do I get it working again.
You're either running the Release compiled version of your code, or the code never reaches where the breakpoint is set.
IS_Assessor wrote: 2. Is there breakpoint toggles as there was in VB6? If so how do you use them?
What's a "breakpoint toggle"? Please keep in mind that I've been using VB5, VB6, VB.NET 2002, 2003, 2005, and the upcomming 2008, and I don't have any idea what you're talking about.
|
|
|
|
|
How to built or construct video in vb.NET application. what tool i should use...?the video was generated from image mosaic
|
|
|
|
|
Do you have a specific question?
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
situation:
I'v created a form with loads server usercontrols. In those usercontrols are all images in a certain folder.
Problem:
I want the user to be able to select one and press delete so that the file is deleted from the hard drive.
I know the path from the file (= property in usercontrol) but when I use
system.io.file.delete(path) I get the folowing message:
"The process cannot access the file 'C:\Documents and Settings\Tom\Mijn documenten\Mijn afbeeldingen\Kopie van Winter.jpg' because it is being used by another process."
After some research I found out that when I use picterbox1.image = Drawing.Image.FromFile(path) vb apperently keeps a link to the file and keeps this file locked.
I thought about declaring a new bitmap put the image in that one and use the internal bitmap. this works fine but the problem I have then is that my tif files only display 1 page and since the program is going to be used in an envoriment where the have alot of tif files (or file like it (more than 1 page in the image file)) this is not really an option.
Anyone know how I can onluck the file so that I can delete it?
|
|
|
|
|
Once presumes that once you delete the file from disk, you no longer show it in the user interface. If so, the solution is to remove the image from the user interface first, then delete the file.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
I'v done this
I first clear the image out of the picterbox
then I remove the usercontrol
picturbox.image = nothing
flowlayoutpanel.controls.remove(usercontrol)
file.delete(path)
this is my complete code for the delete button
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
If MessageBox.Show("Bent u zeker dat u deze file DEFINITIEF wilt verwijderen?", "Bevestiging", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) = Windows.Forms.DialogResult.OK Then
For Each c As Control In flp.Controls
If c.GetType.Equals(GetType(Preview)) Then
Dim pr As Preview = c
If pr.checked Then
pr.Image = Nothing
flp.Controls.Remove(c)
File.Delete(pr.Path)
End If
End If
Next
End If
End Sub
strangly enough I can remove the usercontrol while looping in de controls (thought that wasn't possible since I'v had a simular problem with remove a while back)
but when vb tries to delete the file I get the error
|
|
|
|
|
You haven't disposed of the image just set its reference to Nothing. That means it will be upto the garbage collector when it will actually release the file handle.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
I do this immidiatly after loading the image into the picturebox:
Dim im As Image = Drawing.Image.FromFile(path)
pic.Image = im
im = Nothing
is this what you mean by disposing the image?
|
|
|
|
|