|
Well, surely you must be completely illiterate to read this code and not see the difference ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
functions return a value whereas subroutines (aka methods) do not.
|
|
|
|
|
He'll get a good mark on his homework with that answer.
|
|
|
|
|
I require the user to input some data into a TextBox, then hit an [Accept] button.
The TextBox will then clear and more data will be typed in and once again [Accept].
This will loop through n number of times, then end.
I have created a dynamic array, then enquired how many elements and Redim Array to that number.
I have created a Do While Loop that loops until the Array (n) is reached, n is incremented by a Command Button.
I need the loop to pause until the [Accept] button is hit again.
The only way I can think of doing this is by an InputBox, but it is rather crude, I would rather keep it in the same form.
Do While intJobBreakCounter <= intJobBreaks<br />
arrJobBreak(intJobBreakCounter) = TextBoxJobBreakHeader.Value<br />
TextBoxJobBreakHeader.Value = ""<br />
Loop
Any ideas?
------------------------------------
"When Belly Full, Chin Hit Chest"
Confucius 502BC
|
|
|
|
|
Do you need a loop at all?
In the accept button click can you not increment a counter and set the array value of that position to the textbox then clear the form. Once you have hit accept more than the required number of times you can close the form or whatever you need to do, i.e.
Private intJobBreakCounter As Integer
Public Sub btnAccept_Click()
intJobBreakCounter = intJobBreakCounter + 1
arrJobBreak(intJobBreakCounter) = TextBoxJobBreakHeader.Value
TextBoxJobBreakHeader.Value = ""
If intJobBreakCounter >= intJobBreaks
'Do whatever you need to do
End If
'If you haven't reached the max counter yet the form will still be displayed and the user can enter a new value.
End Sub
|
|
|
|
|
I am a moron!
Of Course.
I was trying to load the data in the wrong sub!
It really didn't occur to me to pick up the array data from the button event!
Thanks
(One day I will be better than this, but in the meantime, I desperately need the wisdom of the CP intelligentsia!)
(I may also point out I am the only person here (here being my work) who does this stuff, everyone else asks me to do it for them, because they can't, so I get stuck with a load of rubbish and little time in which to do it).
I shall edit this in the morning, but thanks once again for letting me see it from a new perspective.
------------------------------------
"When Belly Full, Chin Hit Chest"
Confucius 502BC
|
|
|
|
|
Hi Dave,
I hate it when a program first asks for a count, then loops me through it. It forces me to count first (not my job, who is the computer here?), and then stick to the original number I gave.
I much prefer a GUI that lets me add, as often as I like, so I don't need to count, and I can opt out at all times. Hence:
- forget arrays, use a list instead. (If still using ancient VB, get a large array, and redim down when done; or redim up automatically anytime it is getting full)
- accept input somehow, e.g. entering text in a textbox, then hitting ENTER; and add one item to the list for each ENTER.
- create a way out. An empty input would be such a way. A special symbol or a separate button, or an ESCAPE could all be used.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Luc, so do I , but it was what I was asked for.
See my post above re my Moronism!
------------------------------------
"When Belly Full, Chin Hit Chest"
Confucius 502BC
|
|
|
|
|
Dalek Dave wrote: See my post above re my Moronism!
not sure which of your moronisms you are referring to
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Luc Pattyn wrote: not sure which of your moronisms you are referring to
There are so many to choose from!
------------------------------------
"When Belly Full, Chin Hit Chest"
Confucius 502BC
|
|
|
|
|
I know this might be a very simple question, but im extremely inexperienced in VBA and access but very hardpressed on time.
Basically I have a list box on a form. Lets say Box A. Then I have an empty list box also on that form, Box B. What I'd liek to do is simply have it set up so that while running, if one of the lines on the list Box A is clicked, it will automatically pop up in Box B. I already have everything set up and working apart from that transition.
The idea of the program is to have a selection of files on display, once one is selected it must appear in a seperate box ... and from there i'll attempt to have more fun with it.
Any help is much appreciated, thanks.
|
|
|
|
|
easy: listboxB.Items.add(listboxA.selectedItem)
|
|
|
|
|
Sadly I still havent got it working but thank you anyways.
|
|
|
|
|
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged<br />
ListBox2.Items.Add(ListBox1.SelectedItem.ToString())<br />
End Sub
Put that in the form code, obviously.
|
|
|
|
|
Cheers Mr/Mrs Faded, it turns out though that it was as simple as sticking an equals sign betwen the 2 box names.
|
|
|
|
|
Having a prob...
at the '''dim array and counter
Dim arrJobBreak(intJobBreaks) as String
is throwing an error, saying "Compile Error - Const Expression Required"
What have I done wrong here?
Public Sub CommandButtonOrderJobBreakBegin_Click()<br />
<br />
'''Dim and Load<br />
Dim intJobBreaks As Integer<br />
intJobBreaks = Val(TextBoxOrderJobBreaksTotal.Value)<br />
<br />
'''Check for minimum job break<br />
If intJobBreaks < 1 Then intJobBreaks = 1<br />
<br />
''' make job frame visible<br />
FrameOrderJobBreaks.Visible = True<br />
<br />
'''dim array and counter<br />
Dim arrJobBreak(intJobBreaks) As String<br />
Dim intJobBreakCounter As Integer<br />
<br />
'''load counter<br />
intJobBreakCounter = 1<br />
<br />
'''Array fill<br />
Do While intJobBreakCounter <= intJobBreaks<br />
arrJobBreak(intJobBreakCounter) = TextBoxJobBreakHeader.Value<br />
Loop<br />
<br />
''' confirm end jobbreaks<br />
MsgBox ("Job Breaks Complete")<br />
<br />
End Sub
------------------------------------
"When Belly Full, Chin Hit Chest"
Confucius 502BC
|
|
|
|
|
Dalek Dave wrote: Dim arrJobBreak(intJobBreaks) as String
is throwing an error, saying "Compile Error - Const Expression Required"
I think the error says it all, you can only dim any arr with a constant, not a variable. Try doing a redim instead.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Of Course!
Thanks, I shall attempt that.
Brain must be turning to mush, I forgot about the Redim statement.
------------------------------------
"When Belly Full, Chin Hit Chest"
Confucius 502BC
|
|
|
|
|
Easy done - I try not to use arrays any more.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Ashfield wrote: I try not to use arrays any more
You use more expensive arrays then, there is at least one in almost every .NET collection class. Hidden, more expensive, redimming itself as required, and more comfortable.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
True enough, but easier on the typing finger
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hi to all,
I am facing this problem ....I have put a shock wave object on a form. When i run it, it runs fine....
Then i made a set up file. when i installed it in other machine its not running....
Wat are the necessary staff i need to do? May be some installation on the machine which i have installed the project?
It would be great, if i don't have to rebuild the project and install it again....
Please help me
-----------------------------
I am a beginner
|
|
|
|
|
Install Shockwave on the target machine.
|
|
|
|
|
thanks for the reply......But i am little confused Sir
Do you mean installing Shockwave player?....or something related to dll
-----------------------------
I am a beginner
|
|
|
|
|
Yes, the Shockware Player. It's supplying the COM library your code is using.
|
|
|
|