Darwinbots Forum

Code center => Darwinbots Program Source Code => Topic started by: Zelos on October 08, 2005, 10:22:03 AM

Title: Sentence Split
Post by: Zelos on October 08, 2005, 10:22:03 AM
I hope its ok to ask about VB that doesnt have to do with DB here.

Anyhow im wondering how its done to split a sentence. Like if I have Sentence "ABC" I should be able to split it up to 2 sentences that is like "A" and "AB"
how do I do?
Title: Sentence Split
Post by: Numsgil on October 08, 2005, 11:26:45 AM
Na, it's fine.

The character "_" spits a VB line across multiple lines.

For instance:

form1.caption = "Hello my name is!  Hello my name is!  Hello my name is" + _
                        "The Real Slim Shady."
Title: Sentence Split
Post by: Zelos on October 08, 2005, 11:52:28 AM
no I mean, if I have a sentence like "Hi, my name is zelos" I want to have somekinda command that can store in a memory the letters between X and Y position, so between 5 and 8 in that sentence would be "my n", I want something like that
Title: Sentence Split
Post by: Numsgil on October 08, 2005, 11:54:34 AM
You want the mid, left, and right functions.

I think the syntax is:

left (string, length) = exerpt of the first length characters at the left of string.

Likewise with the others.  Lookup mid's syntax, it's a bit different.
Title: Sentence Split
Post by: Zelos on October 08, 2005, 12:43:09 PM
thx num, that were exacly what I needed. Nums, how do you make a graph like uve done in DB?
Title: Sentence Split
Post by: Numsgil on October 08, 2005, 01:43:03 PM
There isn't an easy way to do it.  I'd check out the graph code in DB.  I didn't program it, but I think it uses line segments...
Title: Sentence Split
Post by: Zelos on October 08, 2005, 02:06:31 PM
ok, I´ll take a look, but nums, how do you check how long a sentence is in letters, like "hi" is 2 and "hello" is 5 and so on
Title: Sentence Split
Post by: Numsgil on October 08, 2005, 02:09:12 PM
strlen(yourstring)

strlen("hello")  would be 5.
Title: Sentence Split
Post by: Zelos on October 08, 2005, 02:15:10 PM
thank you
Title: Sentence Split
Post by: Zelos on October 08, 2005, 02:47:39 PM
hey, it dont work
Title: Sentence Split
Post by: Numsgil on October 08, 2005, 03:12:58 PM
doesn't work how?

Show me what code doesn't work.
Title: Sentence Split
Post by: Botsareus on October 08, 2005, 07:16:23 PM
its Len("ABCDABC8") will give you 8. Not strlen...
Title: Sentence Split
Post by: Zelos on October 09, 2005, 01:23:23 AM
ty
Title: Sentence Split
Post by: Zelos on October 09, 2005, 09:20:44 AM
how do I make so that when you press a button (like calculate in my simple math program) a another menu apphere instant of the one before. But not so that I have 2 different windows
and another thing, how do I make the program run a sequens of orders every X seconds?
Title: Sentence Split
Post by: Numsgil on October 09, 2005, 02:19:38 PM
The "do something every X seconds" involves the timer...  I'm not sure how to do it in VB.  In C it'd be called "multitasking", and you'd set up different threads, and have one sleep for a second then execute...  VB is way different.

When you say another menu, what do you mean?
Title: Sentence Split
Post by: Zelos on October 09, 2005, 02:30:31 PM
Like in DB you have many different menus, some popup infront of the old menu when you press a command button, like advance cost. But instant of apphering infront of it I want it to replace it like when you swich from general to mutation in DB menus
Title: Sentence Split
Post by: Numsgil on October 09, 2005, 03:04:41 PM
You're still going to use different forms for that.  I think it's soemthnig like this:

otherform.show(vbModal)

Or soemthing like that.
Title: Sentence Split
Post by: Zelos on October 11, 2005, 01:21:00 AM
if you mean I have to make a new form that were what I were waiting for., with vbmodal you mean the name of the form right?
Title: Sentence Split
Post by: PurpleYouko on October 11, 2005, 09:39:45 AM
Use the tab strip item like we have in DB's options form.

Then you can just switch between tabs all you like.

Another way is to make items on your form invisible then just make them appear when you want them.
Title: Sentence Split
Post by: Zelos on October 11, 2005, 09:48:48 AM
intersting ideas, ive figured out how the graph worx now, when I feel better im gonna show you something neat, but a question, if I use the line command to create a line, how do I make so I can remove it later?
Title: Sentence Split
Post by: Zelos on October 12, 2005, 08:42:32 AM
plz can Py, Nums or someone else tell me how to remove the lines, When I know that I can finish my thing and show you guys.
Title: Sentence Split
Post by: Ulciscor on October 12, 2005, 08:47:56 AM
I don't think you can treat the line as an object that can be deleted. You can clear a whole picture box though.
Title: Sentence Split
Post by: PurpleYouko on October 12, 2005, 09:17:25 AM
If you drew a line and want to remove it, you have a couple of options open to you.

First, you can redraw the same line in background color.
The problem with this is that it will leave gaps where your line crossed other objects.

A better idea is to have a routine that draws everything you need then call it from your program after clearing the entire window with the CLS command.
Just set your parameters to draw whichever lines you want, clear the whole thing then redraw it from your perameters.
Title: Sentence Split
Post by: PurpleYouko on October 12, 2005, 09:18:48 AM
Quote
strlen(yourstring)

strlen("hello")  would be 5.
does strlen work with VB?

I always use len

len("hello") would be 5
Title: Sentence Split
Post by: PurpleYouko on October 12, 2005, 09:22:19 AM
Quote
I don't think you can treat the line as an object that can be deleted. You can clear a whole picture box though.
Actually you can make a line that is treated as an object. You can make it at design time, set its properties and stuff then modify it at run time. That way you can set its properties later (eg. line1.visible=FALSE)

Trouble is that I'm not sure how to draw a poly-line this way. Straight lines aren't much use on a graph  :D
Title: Sentence Split
Post by: Ulciscor on October 12, 2005, 09:42:29 AM
OK I should have said run-time lines can't be treated as objects :D

Maybe you could use an index array of line objects to make poly-lines?
Title: Sentence Split
Post by: PurpleYouko on October 12, 2005, 10:06:39 AM
probably better to use a one dimensional array to store all the points on a line then Pset them in a subroutine. That way we can delete them just as easy by Psetting them to background again.

You could get really clever and set the graphics mode so that they don't block overwrite. Maybe XOR them on. That way you can just XOR them right back off again and leave everything else unchanged.

Another way would be to set up an invisible graphics window or virtual space, draw everything there then Bitblt the whole thing to the foreground when it's ready. But that is a bit complex for relative beginners.  :D
Title: Sentence Split
Post by: Zelos on October 12, 2005, 10:50:48 AM
I like the idea of clearing the whole box, how do I do that?
Title: Sentence Split
Post by: Ulciscor on October 12, 2005, 11:14:01 AM
picture1.cls
Title: Sentence Split
Post by: PurpleYouko on October 12, 2005, 11:14:49 AM
Assuming you are using a picturebox (named PictureBox1) to display the output graph. just use this command line

Picturebox1.CLS

That will clear all content in Picturebox1.
Title: Sentence Split
Post by: Zelos on October 12, 2005, 11:19:29 AM
ok, what if I use Riquadro?
Title: Sentence Split
Post by: PurpleYouko on October 12, 2005, 11:47:28 AM
Do you mean for the name of your picturebox?

Doesn't matter what you call it. just put .CLS on the end of it.
Title: Sentence Split
Post by: Zelos on October 12, 2005, 12:37:38 PM
Hey, I cant paint lines on the picture box, they disaphere behind it. btw, Riquadro is what is used in the DB graphes to have the graphes on.
Title: Sentence Split
Post by: Numsgil on October 12, 2005, 12:48:34 PM
I don't know what a riquardo is.
Title: Sentence Split
Post by: PurpleYouko on October 12, 2005, 12:50:57 PM
I have never really looked at the code for graphs in DB. I really don't like the way they work so I never use them.

If you want to make the lines appear on any object in VB you have to make sure that you address the object otherwise lines will just appear on whatever the current active object is.

Let me go look over the code a bit.
Title: Sentence Split
Post by: PurpleYouko on October 12, 2005, 12:55:44 PM
OK Riquadro is a rectangular "shape" object drawn onto a form named "Grafico"

Riquadro does not need to be used in any code. It is just four lines making up a rectangle, nothing more.

All drawing should be done with Grafico.

such as.....

Graphico.PSet (xo + xunit * 1, yo - yunit * data(k, t)), col
(taken from the RedrawGraph subroutine

the actual text is Me.PSet........etc. but that only works if the code is located inside the Grafico form.
Title: Sentence Split
Post by: Zelos on October 12, 2005, 02:15:14 PM
but how do I remove all the lines with in it?
Title: Sentence Split
Post by: Ulciscor on October 12, 2005, 02:25:54 PM
Graphico.CLS would sound about right from what PY has said.
Title: Sentence Split
Post by: Zelos on October 12, 2005, 02:36:48 PM
I tried with the name of the thing . cls and it didnt work
Title: Sentence Split
Post by: Ulciscor on October 12, 2005, 02:39:08 PM
Have you done:
Code: [Select]
formname.graphico.clsif you are coding in another form or module?
Title: Sentence Split
Post by: Numsgil on October 12, 2005, 02:53:35 PM
Try to be more specific about what didn't work and what the code looks like, etc.

And make sure you haev "Option explicit" at the top of your VB code.  It catches some programmign errors and forces you to be explicit with new variables, which is a good thing.
Title: Sentence Split
Post by: PurpleYouko on October 12, 2005, 03:00:16 PM
Quote
Graphico.CLS would sound about right from what PY has said.

Actually this would be extremely bad in this case since Grafico is the actual form. It has a bunch of other stuff on it too including the afore-mentioned rectangle.
All drawing in here is done directly onto the form itself rather than into a picturebox.

A general CLS would wipe the entire form.
It would be better to replace the rectangle shape with a picturebox then draw to it instead.
Title: Sentence Split
Post by: PurpleYouko on October 12, 2005, 03:01:41 PM
Quote
Have you done:
Code: [Select]
formname.graphico.clsif you are coding in another form or module?
Shouldn't need to as Grafico is the form itself. This is the highest level object in VB
Title: Sentence Split
Post by: Ulciscor on October 12, 2005, 04:23:01 PM
Oh right! Sorry I thought you meant grafico was a picturebox  :redface:
Title: Sentence Split
Post by: Zelos on October 13, 2005, 01:48:12 AM
I tried using the "line" command to create lines on a picture box but it didnt work :( should I do something to the picture box or command?
the line code look like this
Code: [Select]
Line (xo + Generationstepp * (N - 1), yo - Percentstepp * lastgene(1))-(xo + Generationstepp * N, yo - Percentstepp * Gene(1)), RGB(0, 100, 0)
Title: Sentence Split
Post by: Numsgil on October 13, 2005, 01:50:40 AM
I'm not 100% sure, but don't picture boxes have their own line commands?

so it would be:

pictureboxname.line(....

instead of just

line(....
Title: Sentence Split
Post by: Zelos on October 13, 2005, 05:20:00 AM
really? ok I´ll give it a try then. lets hope ure right then im done and I can show you what ive been working on. so instant of line(blabla) I type ictureboxname.line(blabla) but I dont have to change the "blabla" right?
right now im not using this, but of curiosity, in a progressbar, how do I cchange so it increases/decreases?
Title: Sentence Split
Post by: Numsgil on October 13, 2005, 08:45:07 AM
I've never played with progress bars to be honest.  I bet they have a member function called value, or something along those lines, and another that's max vaue.

So maybe you'd do progressbar.value = 30 or something like that.
Title: Sentence Split
Post by: Greven on October 13, 2005, 09:08:56 AM
Zelos alot of you questions can be answered by the 'Object Browser'.

It is located in 'View -> Object Browser', or just hit F2!

Here you can find (almost) all commands for Objects (picturesboxes etc.) and also other simple commands, though not all commands in VB is here (why I dont know).

In VB when you want to make something to an object (picturebox, text, label etc.) you often need to call their corresponding function:
example

'objectname.function parameters(for the function)'

For the progressbar, you set it by this:
(you can also set it in the properties on design-time, some objects have an additional properties window, to find it right click on the object in question, can choose properties, if it has an additional properties window it will popup)

Code: [Select]
'Sets the minimum for the progressbar
ProgressBar.Min = 0
'Sets the maximum for the progressbar
ProgressBar.Max = 10
'When you need the progressbar to increase in value you write
'Were x is the value it should be increased with.
'Beware that if the .Value, gets over .Max it will raise an error!
ProgressBar.Value = ProgressBar.Value + x

You need to threat all Objects/items in VB as real objects, like when you want to turn on you TV, you dont say just TurnOn... You need to use something like (okay I know, but it is just an analogy)

'If you use the remotecontrol
TV.RemoteControl.TurnOn = True
'If you push a button on the tv, it will be:
TV.TurnOn = True

(Bad example, but I hope it can be used to something)
Title: Sentence Split
Post by: PurpleYouko on October 13, 2005, 09:12:55 AM
Only if he has a version with a decent help file.
Title: Sentence Split
Post by: PurpleYouko on October 13, 2005, 09:22:50 AM
Quote
I'm not 100% sure, but don't picture boxes have their own line commands?

so it would be:

pictureboxname.line(....

instead of just

line(....
Sorry I thought I had explained that already.

Whatever object you want to do anything to has to be named in the command line.

To set a pixel in a specific picturebox, you have to name the picturebox object to do anything to it.

There are several ways to do this with objects.

First and easiest. To draw directly to a form (not an object inside a form) all you have to do is be inside the form code window then type a command line such as....

PSet (X, Y), color

Second method. Drawing to a picturebox that is inside the form in which the code is located.

PictureBox1.PSet (X, Y), color

Third method. Useful if you want to do a bunch of stuff to the same object.

With PictureBox1
  .PSet (X, Y), color
  .PSet (X1, Y1), color
End With

Fourth method. Drawing to a picturebox that is located in a form other than the one where the code is located.

Form1.PictureBox1.PSet (X, Y), color

You can also use "With" in that scenario too.
Title: Sentence Split
Post by: Greven on October 13, 2005, 09:23:35 AM
The object browser, will states all most all functions of a given object, be it picturebox, whatever.
Title: Sentence Split
Post by: Greven on October 13, 2005, 09:24:36 AM
Alot of it you need to figure out you self, but that way it gives alot more, or have I the misunderstood something!??
Title: Sentence Split
Post by: PurpleYouko on October 13, 2005, 09:30:32 AM
Right the object browser does give you all the members for each command so I guess it can be pretty useful.

You also get all this same stuff when you type in a command line.
Title: Sentence Split
Post by: Numsgil on October 13, 2005, 09:31:37 AM
Right:

objectname then type "."

A small popup of all members appears.
Title: Sentence Split
Post by: Zelos on October 13, 2005, 11:54:16 AM
I figure out alot on my self. but sometimes it aint that easy when you cant find all commands on a list.

but thx anyway ^_^ with ur help I learn alot and get trough those things I cant figure out on my own
Title: Sentence Split
Post by: Numsgil on October 13, 2005, 02:27:00 PM
I think you're doing quite well for no programming background.

VB is nice that way.  It isn't terribly impossible to pick up.
Title: Sentence Split
Post by: Zelos on October 13, 2005, 02:55:19 PM
why thanks nums.
Title: Sentence Split
Post by: Numsgil on October 13, 2005, 03:01:33 PM
Just be sure when you finish a project you let others critique your code, or you'll get stuck in bad programming habits that will be difficult to break.

Not that there's only one right way to code, but there are definately some that are less right than others.
Title: Sentence Split
Post by: Zelos on October 13, 2005, 03:15:03 PM
right now im happy it worx, but of course I´ll show you the programming so you can show how I can improve it. its rather primetive if you ask me
Title: Sentence Split
Post by: Numsgil on October 13, 2005, 05:59:45 PM
You would barf in absolute disgust if I showed you the first forms I started working on in VB.  VB is a language that takes some practice to make look elegant.
Title: Sentence Split
Post by: Zelos on October 14, 2005, 02:16:39 AM
I bet on that, practive gives perfection you know.
Title: Sentence Split
Post by: Zelos on October 14, 2005, 08:20:21 AM
Here is my program, it is finaly working. or atleast I belive it does
you can change the amount of generations it show, how good a gene is, its frequens in the population. how many alleles it is, and sexes. What do you think guys?
Title: Sentence Split
Post by: Ulciscor on October 14, 2005, 08:36:31 AM
Well I get an overflow whenever I click the graph button, no matter what values I put in...
Title: Sentence Split
Post by: Zelos on October 14, 2005, 08:39:27 AM
0 values arent possible, with 2 alleles you need to fill gene A/B with 3 alleles All genes have to have values.
but the program is acting wierd since I changed it into a picturebox
Title: Sentence Split
Post by: Ulciscor on October 14, 2005, 08:41:36 AM
Yes but I still get overflow.
Title: Sentence Split
Post by: Zelos on October 14, 2005, 08:56:28 AM
strange, im using the same file and it worx for me. are you using half best or straight mode? if ure using half best you gotta give it a value aswell. else I have no idea. But here is the coding if you wanna take a look
just remember its my copyright
Title: Sentence Split
Post by: PurpleYouko on October 14, 2005, 09:08:25 AM
Works fine for me. Not a bad little program.

You have to enter values into all the genes text boxes or else it will crash. That is the only problem.
Title: Sentence Split
Post by: Zelos on October 14, 2005, 09:42:47 AM
as I said, py how do I fix that?
Title: Sentence Split
Post by: PurpleYouko on October 14, 2005, 09:51:57 AM
Just add a bit of code that checks if any of these values are zero. If they are then display a message and "exit sub"

eg.
Code: [Select]
if A1.text="" then
  msgbox("You must enter a value into the first gene before you can run the program")
  exit sub
endif

just OR your conditions together to cover all 6 gene textboxes and you have a failsafe.
Title: Sentence Split
Post by: Zelos on October 14, 2005, 11:10:42 AM
ok thx. I wonder if there is something wrong with the program or if its so that the lines are to small or if its so that they put over each other but sometimes the graphes aint showing
Title: Sentence Split
Post by: PurpleYouko on October 14, 2005, 11:21:34 AM
The showed every time I ran the program.

What conditions make them NOT show?
Title: Sentence Split
Post by: Numsgil on October 14, 2005, 11:56:37 AM
I'll totally DL and run it later today.  Good work Zelos.
Title: Sentence Split
Post by: Zelos on October 14, 2005, 01:04:14 PM
I ran with more than 2 sexes or more than 2 alleles. or both of them. but it might simply be that they are over each other or something.
thx nums, but I would be happy if you could come with how I could improve the coding to be more professional.
Title: Sentence Split
Post by: Greven on October 14, 2005, 01:22:51 PM
Actually it is better to use IsNumeric()-command, to check if there is any errors.

Exception handling, as I have stated before, everything that can be done wrong in a computer program, goes wrong. Somehow a user will always try to test the program in the most absurd ways, just to check if it works.
Title: Sentence Split
Post by: Numsgil on October 14, 2005, 01:46:29 PM
Darwinbots' GUI is that way.  There's sparse little checking to see if the values are absurd or not.
Title: Sentence Split
Post by: Zelos on October 14, 2005, 03:33:04 PM
how do you mean absurd? could you give an exemple?
just of curiosity, what data file on db source is the file that "paint" all the boits and show what happens? not proccesing all the things, just paint the bots and shots as we see them.
Title: Sentence Split
Post by: Numsgil on October 14, 2005, 03:48:58 PM
There are a series of commands that paint things graphiclly to the screen.  I believe they are all in Form1.

DrawRob
DrawRobPer
etc.

They are all grouped together, shouldn't be difficult to find.

An absurd value would be 500000000 nrg per cycle to vegs.  I don't think the program catches that.
Title: Sentence Split
Post by: Zelos on October 14, 2005, 03:57:42 PM
there is nothing called Draw things.
Title: Sentence Split
Post by: Numsgil on October 14, 2005, 07:03:35 PM
No, there isn't.  But DrawRob should exist.  I knowDrawRobPer exists.

Looked at your code, I'm really impressed.  Only things I'd recommend:

1.  Indenting.  It's a style thing only, has no effect on the code, but it makes it more readable.  Look at Darwinbots' code for examples of when you would indent or unindent.

2.  You would be better off grouping code into their own Subfunctions, that themselves call smaller syub functions, etc.

So that your main code would look like:
Code: [Select]
Setup
Do
  CheckInput
  UpdateGraph
loop while blah blah...

Like that, it makes the program look more professional.  In the end, you'll have a tree of functions, that all call smaller functions, that call smaller functions, etc.
Title: Sentence Split
Post by: Botsareus on October 14, 2005, 07:47:02 PM
Num Num Num, too mutch collage brainwash:

Quote
Like that, it makes the program look more professional.

We are not worried about professional here, we are worried about user frandly. Thats why we do it.

I seen some professionals do some really stuped things when they code thinking its professional, thats why I hate .net so much.
Title: Sentence Split
Post by: Numsgil on October 14, 2005, 08:19:56 PM
Are you saying its better to place all the code in a single function  :rolleyes:

There is one paradigm that overcomes all others in coding style:  Make it readable!  Make it readable to someone who knows nothing about your source, and make it readable to yourself 7 months from now when you have no idea what you were doing when you programmed the thing to begin with.
Title: Sentence Split
Post by: Botsareus on October 14, 2005, 08:27:21 PM
In this case you are correct Num.
Title: Sentence Split
Post by: Numsgil on October 14, 2005, 08:29:23 PM
I can't begin to tell you the number of times I've programmed something only to come back 6 or 7 months later and have no clue how it works.

Always Always Always try to make it as readable as possible.  That's what really takes practice.
Title: Sentence Split
Post by: Botsareus on October 14, 2005, 08:34:27 PM
I agree. Infact happens to me often enough too. When I was 11 it did not happen to me , so I would not worry about it. Gess I have to start worrying about it now.
Title: Sentence Split
Post by: Zelos on October 15, 2005, 04:42:36 AM
nums, I dont get what you mean with ur 2nd point, could you explain it a bit better?
and nums, whe ni look in the iersera file with VB, I dont find a file/form or what ever its called that is called anything with draw in it. I find datiriob,dna_help, database, dnaexcution , dnamanipulation and dnatokinization. but nothing draw, am I blind or am I looking at the wrong place?
Title: Sentence Split
Post by: Numsgil on October 15, 2005, 12:20:01 PM
Look in the form "Form1".  There's a section inside it that does the drawing.

My second point...  I'm not really good at explaining this.  Basically it'd work like this:

Your main function only calls like 6 or 7 other functions.  These functions are named something really basic.  Then your main loop looks like:

do
  Updatebots
  Updateshots
  Drawbots
  Drawshots
loop

Or something like that.  Then the Updatebots function looks something like:

for x = 1 to 1000
  UpdateDNA
  UpdatePhysics
next x

or something like that.  You keep breaking the problem down into more and more sub functions.  It makes the program more readable, and is what is generally considered "proper" programming technique.
Title: Sentence Split
Post by: Zelos on October 15, 2005, 12:23:19 PM
are you talking about mdiform1? if so I´ll take a look at it. thx
Title: Sentence Split
Post by: Numsgil on October 15, 2005, 12:24:22 PM
Nope, Mdiform is different.  This is called "Form1".
Title: Sentence Split
Post by: Zelos on October 15, 2005, 12:38:23 PM
OH, now ive found it, now I feel kinda silly
Title: Sentence Split
Post by: Zelos on October 15, 2005, 02:17:28 PM
AHA, I knew it. but still im supriced. I guessed you could use lines to paint bots like my graphes. and you suspected it would be like that, but still im surpriced.
Title: Sentence Split
Post by: Numsgil on October 15, 2005, 02:33:32 PM
The graphics you see during a simulation are all VB functions.  Draw circle, etc.

Really, really basic.
Title: Sentence Split
Post by: Zelos on October 15, 2005, 02:34:25 PM
yeah, but as a noob in programing im still kinda surpriced
Title: Sentence Split
Post by: Numsgil on October 15, 2005, 02:37:15 PM
That's part of why I'm porting it.  OpenGL allows some raelly neat visual effects.  Like for bioluminescence, you could actually show the bot glowing!  How cool would that be.
Title: Sentence Split
Post by: Zelos on October 15, 2005, 02:38:44 PM
that would be cool, porting? what does porting mean?
Title: Sentence Split
Post by: Numsgil on October 15, 2005, 02:41:06 PM
Porting means rewriting a program from one platform for another.

I'm rewriting the engine to use C++, since about half of the clock cycles currently are spent by Visual Basic doing things in C++ that would take a tenth of the time.
Title: Sentence Split
Post by: Zelos on October 15, 2005, 02:42:02 PM
nice, very very nice, is there any big differenses between c++ and vb? I mean programming like
Title: Sentence Split
Post by: Numsgil on October 15, 2005, 02:43:09 PM
C++ has alot of things VB doesn't, but VB doesn't really have anything that C++ doesn't.

So I recommend learning VB first, and then making the switch to C++.  80% of C++ will make sense to you if you know VB already.
Title: Sentence Split
Post by: Zelos on October 15, 2005, 03:10:55 PM
hmm, sounds like a good idea, and I can trust you?
btw nums a question, where do I find the file that loads a txt file and read it?
Title: Sentence Split
Post by: Numsgil on October 15, 2005, 04:44:24 PM
It's in HD_Routines or HDRoutines, I forget what I named it.
Title: Sentence Split
Post by: Zelos on October 16, 2005, 02:37:28 AM
ok, how does the program calculate how many cycles that can go on each second? and if I have a toolbar with buttons, how do I add picture to them?
and if I sett a variable to public, can other files read it?
Title: Sentence Split
Post by: Zelos on October 16, 2005, 05:18:18 AM
im experimitating now, but nums I have a problem. Take a look at this sinus program ive made. it shows a sinus curv when you press the buttom to the left. But why does it flimmer (is it called that in english?)? and how do I fix that?
Title: Sentence Split
Post by: Zelos on October 16, 2005, 05:22:38 AM
It might help if you see the coding.
Title: Sentence Split
Post by: Ulciscor on October 16, 2005, 07:22:16 AM
You need to zip all the project files together, not just give the main project file.
Title: Sentence Split
Post by: Zelos on October 16, 2005, 07:35:14 AM
nemas problemas
Title: Sentence Split
Post by: Ulciscor on October 16, 2005, 07:38:47 AM
Set the 'autoredraw' property for the picturebox to false.
Title: Sentence Split
Post by: Zelos on October 16, 2005, 07:57:16 AM
it is false, but didnt you mean true? cause when I set it to true it vanished and another thing, in the condition I see things as condition(X as integer) what does that mean?
Title: Sentence Split
Post by: Ulciscor on October 16, 2005, 08:11:48 AM
What condition?
Title: Sentence Split
Post by: Zelos on October 16, 2005, 09:59:11 AM
any condition. like in db
Code: [Select]
Form_MouseDown(button As Integer, Shift As Integer, x As Single, y As Single)and so on, btw that thing with the tool bar, ignore it. ive figured it out.
Title: Sentence Split
Post by: Ulciscor on October 16, 2005, 10:13:15 AM
Those are the arguements passed to the function when it is triggered, if that's a good definition.

From your example, when a mouse button is pressed, the values in parenthesis are passed to the function for you to use. I.e. 'button' is the value corresponding to which button has been pressed, left or right. I'm not totally sure what 'shift' is, but 'x' and 'y' are the coordinates of the point the cursor was at when the button was pressed.

The 'As Integer' part means that the arguements are being passed to the function  as integer-type variables.

Someone please correct me if any of this is wrong!
Title: Sentence Split
Post by: Zelos on October 16, 2005, 11:02:25 AM
so the things with in the () is values passed from one function to another? thx
Title: Sentence Split
Post by: Ulciscor on October 16, 2005, 11:03:53 AM
Maybe parameters is a better word than arguements, but yes.
Title: Sentence Split
Post by: PurpleYouko on October 16, 2005, 12:55:35 PM
You got it exactly Ulc. Nice explanation.  :)
Title: Sentence Split
Post by: Zelos on October 16, 2005, 01:20:50 PM
yepp, its very very sweet but how does the program calculate how many cycles it goes each second?
Title: Sentence Split
Post by: Numsgil on October 16, 2005, 03:17:07 PM
Every time a full cycle is implemented, it increments a counter somewhere.

There's a timer control in MdiForm that activates 1 every second.  Upon evry activation, this timer checks to see how many cycles have happened since it last looked.
Title: Sentence Split
Post by: Zelos on October 16, 2005, 03:28:12 PM
so you just let the program run cycles where it do all stuff, stuck it up and then it shows how many it were in a sec?
Title: Sentence Split
Post by: Numsgil on October 16, 2005, 03:31:58 PM
Right.  You'll have to hunt down the ActiveX control that runs the time, I don't remember what it's called.  Looks like a clock I think.
Title: Sentence Split
Post by: Zelos on October 16, 2005, 03:45:10 PM
I know how to use a timer
Title: Sentence Split
Post by: Numsgil on October 16, 2005, 04:03:39 PM
Oh good.  I think I looked at it once or twice, but it doesn't come up too often, so I'm a little fuzzy on how all it works.
Title: Sentence Split
Post by: Zelos on October 20, 2005, 12:05:51 PM
on what file is the thing in db so you can add species and search on the drive?
Title: Sentence Split
Post by: Numsgil on October 20, 2005, 12:11:36 PM
It's in options form I think.

Go to the actual graphical form for options.  Click on the "add species" button.  That should take you to the text code that handles it.
Title: Sentence Split
Post by: Zelos on October 20, 2005, 01:56:36 PM
ok, but what is "CommonDialog1" for thing? is it something in VB or just something in db? and what does it do?
Title: Sentence Split
Post by: Numsgil on October 20, 2005, 02:40:39 PM
CommonDialog1 is an instance of a common dialogue control.

Dialog controls are those "where is the file you're looking for" dialogue boxes.
Title: Sentence Split
Post by: Zelos on October 20, 2005, 03:06:05 PM
so its a vb thing?, nums is there a way to change the case in a sentence so all parts is lower case?
Title: Sentence Split
Post by: Ulciscor on October 20, 2005, 04:41:23 PM
It's quite possibly
Code: [Select]
lcase(string) where string is the arguement.
Title: Sentence Split
Post by: PurpleYouko on October 20, 2005, 04:48:14 PM
That was what I thought too but when I looked it up int the help files it looks like this only applies to ODBC database interactions.

Haven't had the time to test it yet to find out.

Another possibility is Lower(string)
Title: Sentence Split
Post by: Zelos on October 22, 2005, 04:28:41 AM
ive been starting to experimentate with commondialog, when ive open a file with it like this:
Private Sub Command1_Click()
  CommonDialog1.ShowOpen
End Sub
how do I make so it apphere in a text box or stored as a string?
Title: Sentence Split
Post by: Numsgil on October 22, 2005, 11:08:50 AM
Now we're getting into areas of VB I'm still fuzzy in.
Title: Sentence Split
Post by: Botsareus on October 22, 2005, 11:12:29 AM
I don't get the qustion:

Quote
Private Sub Command1_Click()
CommonDialog1.ShowOpen
End Sub
how do I make so it apphere in a text box or stored as a string?

You mean how do you get the path into a string? It is :
Quote
FileName Property
     

Returns or sets the path and filename of a selected file. Not available atdesign time for the FileListBox control.

CopyLeft msdn only in the case of needing that a person gets msdn.
Title: Sentence Split
Post by: Numsgil on October 22, 2005, 11:51:06 AM
I think Bots is saying that it'd be:

Private Sub Command1_Click()
CommonDialog1.ShowOpen
End Sub

some_string = CommandDialog1.FileName
Title: Sentence Split
Post by: Zelos on October 22, 2005, 12:33:15 PM
thx, a question,m if I have a list, how do I with commands add something to the list?
Title: Sentence Split
Post by: Botsareus on October 22, 2005, 12:46:44 PM
GET MSDN GOD DAM IT.

Private Sub Form_Load()
List1.AddItem "moo"
List1.AddItem "beee"
End Sub
Title: Sentence Split
Post by: Zelos on October 22, 2005, 01:24:51 PM
^_^ this is getting fun ^_^
the thing is that a human is easier to understand. and another thing, when I use this to open a txt file:
Private Sub Command1_Click()
CommonDialog1.ShowOpen
Open CommonDialog1.FileName For Input As #1
Input #1, variable1
Text1.Text = variable1
Close #1
List1.AddItem CommonDialog1.FileName
End Sub
it only shows in text1 the first row, wgy? and how do I fix it?