Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Excel/VBA - User Input Through A Chart?

Wondering if someone could offer some advice...

I'm writing a VBA script to do some test-data post processing, part of which includes extracting small chunks of data from large arrays. A really good way for me to do this visually would be to have my script create a Y-vs-time plot which would allow the user to simply click on a single point as a start, another point as an endpoint, and then steal the array data between them (the tests are such that there are clear breakpoints which are easy to see visually, but a hassle to extract from a tabular set).

Making the plot, that's easy...analyzing the data once I get it, no problem...I've got a Class Module defined which would allow me to perform the actions I want, if I could get at the plot...the problem is, how do i hand over control from my script as it runs, to wait for the user to choose a point? I thought a SetFocus-type command could to the job, but i'm finding that it doesn't seem to apply to chart objects?

any ideas? I'd be most grateful! cheers,

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Excel VBA - Graph/Chart On User Form
Good morning ladies and gentlemen,

I would like to start off by saying that I have been searching high and low for a solution to the following problem. Some of the solutions I’ve found on this site and others are either to difficult or not exactly what I’m looking for.

I would like to see an example of the following….

I would like to be able to place a graph/chart on a user form so that data can be displayed in real time. This would be like having a strip chart showing data from a data logger. Data is stored within the spreadsheet and a new row of data is added every n number of seconds/minutes (user defined scan rate). I have the incoming data setup and working flawlessly, I would just like to be able to reference a few cells and graph them on a user form every time new data is brought into the spreadsheet.

Any help I can get would be greatly appreciated.


Show An Excel Chart On A User Form On VBA
how can i insert data to a data grid or an excel sheet and than show it in a chart onmy form, without the need to open excel application???

Generating Excel User DefinedBuilt-In Chart

I'm trying to generate an Excel 97 chart from a VB6 program. The type of chart I want is a Line - Column on 2 Axes. This is a built-in type, so my line of code to set it looks like this:

xlChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:="Line - Column on 2 Axes"

But when the chart is generated, it is type 51 (clustered column). It doesn't matter if I create a user-defined chart that is based on "line - column on 2 axes", the chart still comes out as type 51.

Does anyone have any suggestions?


Excel And User Input
I have a command button on a spreadsheet.
this button copies values from a master sheet to where the user want it to go.
how can I prompt the user to select a cell with the mouse?
I will then copy the info to the active cell(the one the user clicked)

any ideas?
thank you for your time and have a good day

Creating A Dynamic Chart From A User Form In Excel (Just A Start Please)
Hi Guys I have to do this

Task 2: Spreadsheet
Keerside Primary school has a weather recording project that is undertaken by the infant classes. At noon each day pupils record the rainfall for the last 24 hours and the temperature at noon. These two figures are entered into a spreadsheet and used to produce a graph showing both rainfall (as a bar chart) and temperature (as a line graph) for the calendar month. The spreadsheet also calculates the average rainfall and temperature for the month so far.
Because the spreadsheet is to be used by infant children the school want an interface that is simple to use and does not require the pupils to enter data directly into the spreadsheet. Your task is to create a user form in VBA which is automatically displayed when the spreadsheet is opened and which allows the pupils to select the month and date in the month from combo boxes and to enter the rainfall and temperature into text boxes. Once this is done the pupils can select a command button to transfer the data into the correct worksheet (there should be one for each month) and then display the sheet showing the weather recordings for the month, the graph and the averages. From the sheet the pupils should be able to quit the spreadsheet using a command button.
For this task you only need to include sheets and write VBA code for January, February and March. You should hand in a copy of your spreadsheet on disk.

Any help would be greatly appreciated


Edited by - venture on 8/31/2003 8:29:35 AM

User Input From An Excel Macro
I recorded a simple macro in to import a text file. It sets several variables for me. I need to figure out how to make it ask me for the file name and the cell I need to drop the file into. It tries to bring in the same file everytime. Any help would be great. Macro as recorded is below.

Sub Import()
' Import Macro
' Macro recorded 1/27/2004 by bjohnson
' Keyboard Shortcut: Ctrl+q
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;I:5688.0008-MethanolDatafilesJB012204-8*.txt", Destination _
.Name = "*"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierNone
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.Refresh BackgroundQuery:=False
End With
End Sub

User Input In Excel Changing What Macro Does
Hi everyone,

I'd like to know if this is possible. If anyone knows then please let me know.

I've got a macro in excel that opens an existing workbook, saves it as something else and then creates a new one based on the last one.

At the moment the user needs to browse for the file to open (the folder it is in automatically opens to point them in the right direction) and the they are again taken to the correct folder in which to save the new file.

I want to avoid them having to look at the save as / open dialog boxes and only have to type the names of the files to work with.

So . . . . . . What I would like is a kind of interface in Excel. eg

last file to open _____________

New file to create _____________

On top of these lines the user would type "Week 1" for the file to open
and "Week 2" for the new file to create.

If these underlines were actually cells in excel can I just tell the macro to open/save C:My DocumentsFolder[cell value as input by user].xls



Checking For User Input In An Excel Macro
I want to be able to check to see if a user has pressed a 'Stop' button
when I am running a query using VBA and populating an Excel Spreadsheet.

Excel seems to hang up whilst I'm in the macro.

Is there any sort of functionality that allows this type of thing?



Attempting To Use User Input To Determine Potential Duplicate Entries In Excel
Hey all,
I am trying to get a VBA to work in excel and am having difficulty with getting a specific part to get working. Mostly because I am unfamiliar with the VBA for Excel.

What I need to in the Code: 'check for a movie in the database is to take the user input from Me.txtmovie.Value and check against an entire column. If there is a duplicate located to output a msgbox indicating what the duplicate is.

Suggestion? Help? Code?


Code:Private Sub cmdAdd_Click()

        Dim iRow As Long

        Dim ws As Worksheet

        Set ws = Worksheets("moviedatabase")

         'find first empty row in database

        iRow = ws.Cells(Rows.Count, 1) _

          .End(xlUp).Offset(1, 0).Row

        'check for a movie in the database



        'copy the data to the database

        ws.Cells(iRow, 1).Value = Me.txtencodeid.Value

        ws.Cells(iRow, 2).Value = Me.txtstudio.Value

        ws.Cells(iRow, 3).Value = Me.txtmovie.Value

        'clear the data

        Me.txtencodeid.Value = ""

        Me.txtstudio.Value = ""

        Me.txtmovie.Value = ""


 End Sub

Private Sub cmdClose_Click()
      Unload Me
End Sub

    Private Sub UserForm_QueryClose(Cancel As Integer, _

      CloseMode As Integer)

      If CloseMode = vbFormControlMenu Then

        Cancel = True

        MsgBox "Please use the close button!"

      End If

    End Sub

Edited by - nadragul on 2/15/2007 7:07:21 PM

How To Copy A Chart From One OLE Excel Sheet To An OLE Excel Chart Object
Hi all,

Kinda stuck here and I have been searching for the way to do this all day. I have a spreadsheet with Charts in one VB OLE container (Excel.Sheet.8)and I want to copy one of the charts to another VB OLE container (Excel.Chart.8) and have it sized to fit in my OLE container. I cant seem to get it to work. Any help?

Where OLE1 = spreadsheets with charts
and OLE2 is a chart

OLE1.Class = "Excel.Sheet.8"
OLE1.SourceDoc = App.Path & "Data5.xlt"
OLE1.Action = 0
'... Work with the spreadsheet...
OLE2.Class = "Excel.Chart.8"
OLE2.Action = 0
Set OLE2.object = OLE1.object.Charts(1) 'Doesnt Work
OLE2.object.Height = 5000 'Doesnt Work
OLE2.object.Width = 10000

Let User Input IP And Limit It To Numeric Input?
I wanna let the user input an IP address..
I had search on the forum and found sth like this..


Originally Posted by dglienna
Just use a textbox with a regular text field. You can't have a number with more than one period (dot) in it. You can even use a mask to put in the dots.

What is a mask and how can put it in my program?
and, is it possible to set this textbox for numeric input only ??
and set the max value = 255 (since it's IP address..)

Hope someone could help ~

Draw Bar Chart ,pie Chart In Excel Using Vb
i want to draw pie,bar chart in excel using vb. database is ms access. pls advise me.

Prevent User From Moving Chart
I'm using MSchart in an application.
In the application I allow the user to select points on the chart. So I have to allow selections in the chart property window.

However if a user clicks on the chart, holds the button down, the user can drag the chart around inside the chart window.

And once the user has done that, he/she can now use the right mouse button and resize the chart itself.

I want to be able to allow the user to only select points on the chart. Nothing else.

Any help would be greatly appreciated.


Stop User Moving The Chart Around In MsChart

I am using MsChart. I need to allow selections but when this is set to True users can click on the chart and move the plot area around the unplotted area.

Anybody know a way to avoid this


Excel Chart - Paste Special As Picture In Excel Itself
Hi All,

I am working on a report and it needs to be generated daily. After generating and creating charts, I need to paste special those charts as "Pictures". Is there any way to do this? And also i need to paste special every single chart in the work book. I already done a code but it not working properly.. and the important point is i need to paste special the chart at the exact position where i intended to cut. Is this possible???

Pls treat this as emergency and advice me on this.

Thanks in advance..


Excel 2000, Create Powerpoint Org Chart From Excel.
I want to create a powerpoint org chart from Excel using information held in Excel. I have found how to add an Org chart into Powerpoint but can't find anywhere that tells you how to change the details/options or add Subordinates Managers etc and alter those details.

Anyone have any ideas (I don't want to create seperate text boxes if possible.)

Ps if you can create a good powerpoint org chart from excel, any ideas on the best layout of information in the spreadsheet to work through and create it.

This is one of those, that would be good if you can do it (created them in the past and are time consuming pains), rather than has to be done last week ideas.



Pie Chart Not Visible On User's Machine Using Visual Basic Application

We are using Crystal Repors 7.0 (Seagate software) and Visual Basic 6.0. We could able to see chart on only one of our developer's machine from Visual Basic Application Where as we are unable to see the PIe chart on other developers machines and user's machines.

We could able to see the pie chart and graph from Print Preview of crystal reports designer.

We have re-install Crystal reports several times, but it did not help.

It's urgent. If anybody has faced such problem. let us know

Help With User Input
I have a bunch of textboxes and combo boxes with an input command button. Is there a fast way of seeing if text ins't inputted into either the textboxes or combo boxes, the user will get a message saying to fill it out?

User Input Vb6
guys i am in desparate need of some help.. i need to hand my assignment in first thing tm morning and am having such problems with part of my code. the code i have is below and it involves the user clicking on a command button and writing information to a text file. and then there is another command button to read off the data. however, i really need to be able to add code so that if the user enters alphabetic data into the second input box (asking for a phone number) then i would like a message box to appear saying only numbers allowed. i have tried everything but can't get it to work.. i am having such problems and would appreciate any help please.

Alos, the second thing is that if i add details using the command button and then press the cancel button on the input box after adding a few entries.. then read the saved details off.. and then press write to file command button again to add a few more, the run time error appears saying that file is already open.. i am presuming that i need a close statement in there somewhere ut i can't figure out where to put it in or how.

any other suggestions to add are more than welcome.. its for a very important program that needs showing tm morning. thank you so much!!!

User Input
basic question very dumb but i dont know how to do it, here is some background first. im makeing a mole converter for chemistry and i have many text boxis and labels i need to type in text1.text and at the same time i do that i need to have that show up in the lable1.caption

User Input!
Vb seems to be pretty simple, i have started the program and have a perty box with a lable that reads "Type in the below box" olong with an ok buttone.

i am wonting to creat a program for writing estamits, so after the Boss enters lets say, the car holders name, the custamer, what would be the best way to go for printing it to paper when all is done? also planning that i would want some things in the text like, ???? AUTO PAINtERS to always be bold and red? what would be the best rout for this, The point of the program is to basicly do it for you, you could think of it as a time saver.
and could someone point me to some commands or examples

Getting User Input
Ok, I got a code from someone on the forums or making a new dir if its not already there blah blah now I want it to be so whats in the text box to use as the folder name and stuff ... ? ... heh, any guestions you may need to ask me go ahead!


Edit - I got part one, now for it to work the right way! :P
Edit2 - Well what I though was it working was really nothing below I will post the code I was using!

VB Code:
Dim mkyourdic As StringPrivate Sub Command1_Click()If Dir$("C:mkyourdic", vbDirectory) <> vbNullString Then   MsgBox "mkyourdic already exists"Else   MkDir "C:mkyourdic"   MsgBox "Made!"End IfEnd Sub  Private Sub Text1_Change()mkyourdic = Text1.TextEnd Sub

No User Input?
I am using a sendkeys statement with a webbrowser control....

Question 1 - Can i make the sendkeys statement object orientated, so it send the message to ONLY the webbrowser, no matter what has focus?

Question 2 - Can i make the Webbrowser so you cannot enter ANY user input on it?

I would appreciate any and all help i can get with this, because this is an urgent application i must finish.

Input From User (Please Help)
I'm a noobie programmer, so far I have learned objects, such as buttons, input boxes, labels, check boxes etc, etc... But, before going on to learning more, I would like to know how to retreive input from a user. I would like to know, when a user inputs data into a object, such as a input box, how do I display that in a label box??? Please give info, and a example.


User Input
I'm trying to put together a recipe database in which the user can print out a shopping list from selected recipes. This, of course, requires that the ingredients be separate from the instructions.
Is it possible to use the listview control as an input control? If not, which is what I suspect, is there any other control besides the textbox for input? Any suggestions on how to use the textbox?

Old Man

User Input? Best Way....
Ok this is kinda simple question.....

I would like a user to give me input for several custom messages to be sent from them to other users during game play. Such as the feature in Starsiege Tribes (close)

Whats the best way to gather custom text from a user and store it and be able to send it out when a user hits a hotkey?

User Input
How would I use the information that a users submits on a login as the infomation for the db login? Some what like storing them to variables for later use through out the program or until a user logs out....

Isaiah - Microsoft Visual Basic MVP

Copy Excel Chart From Excel To Word?
I need the code to copy an excel chart from an Excel sheet to a word doc.

Could it be something like:

ActiveChart.Copy ???

User Input From DXInput
I have a problem with the user input. I mean, the user input works fine no problems. But the problem I have is that the animation starts when the key is down but when you lift it it continues running. I'm using Keyboard_KeyDown(ByVal lKey As Long) (see below). Can anyone help???? It's beginning to drive me mad!

Private Sub Keyboard_KeyDown(ByVal lKey As Long)
' Keyboard_KeyDown - raises an event when a key is pressed
' -------
' lKey - value of the key pressed
Static bWireframe As Boolean

Select Case lKey
Case 203 'left arrow
qmd2.Set_Rotation qmd2.Vrotation.X, qmd2.Vrotation.Y + 0.04, 0
PlayerPos.X = PlayerPos.X - 1
vCameraSource.X = PlayerPos.X
vCameraSource.Y = PlayerPos.Y + 20
vCameraSource.Z = PlayerPos.Z - 20
vCameraTarget.X = PlayerPos.X
vCameraTarget.Y = PlayerPos.Y + 20
qmd2.Set_Position PlayerPos.X, PlayerPos.Y, PlayerPos.Z
qmd2.CurrentAnimation = 1
qmd2.CurrentFrame = qmd2.AnimStartFrame(qmd2.CurrentAnimation)
D3DXMatrixLookAtLH matView, vCameraSource, PlayerPos, d3d.CreateVector(0, 1, 0)
d3d.Device.SetTransform D3DTS_VIEW, matView

Case 205 'right arrow
qmd2.Set_Rotation qmd2.Vrotation.X, qmd2.Vrotation.Y - 0.04, 0
PlayerPos.X = PlayerPos.X + 1
vCameraSource.X = PlayerPos.X
vCameraSource.Y = PlayerPos.Y + 20
vCameraSource.Z = PlayerPos.Z - 20
vCameraTarget.X = PlayerPos.X
vCameraTarget.Y = PlayerPos.Y + 20
qmd2.Set_Position PlayerPos.X, PlayerPos.Y, PlayerPos.Z
qmd2.CurrentAnimation = 1
qmd2.CurrentFrame = qmd2.AnimStartFrame(qmd2.CurrentAnimation)
D3DXMatrixLookAtLH matView, vCameraSource, PlayerPos, d3d.CreateVector(0, 1, 0)
d3d.Device.SetTransform D3DTS_VIEW, matView

Case 200 'up arrow
PlayerPos.Z = PlayerPos.Z + 1
vCameraSource.X = PlayerPos.X
vCameraSource.Y = PlayerPos.Y + 20
vCameraSource.Z = PlayerPos.Z - 20
vCameraTarget.X = PlayerPos.X
vCameraTarget.Y = PlayerPos.Y + 20
qmd2.Set_Position PlayerPos.X, PlayerPos.Y, PlayerPos.Z
qmd2.CurrentAnimation = 1
qmd2.CurrentFrame = qmd2.AnimStartFrame(qmd2.CurrentAnimation)
D3DXMatrixLookAtLH matView, vCameraSource, PlayerPos, d3d.CreateVector(0, 1, 0)
d3d.Device.SetTransform D3DTS_VIEW, matView

Case 208 'down arrow
PlayerPos.Z = PlayerPos.Z - 1
vCameraSource.X = PlayerPos.X
vCameraSource.Y = PlayerPos.Y + 20
vCameraSource.Z = PlayerPos.Z - 20
vCameraTarget.X = PlayerPos.X
vCameraTarget.Y = PlayerPos.Y + 20
qmd2.Set_Position PlayerPos.X, PlayerPos.Y, PlayerPos.Z
qmd2.CurrentAnimation = 1
qmd2.CurrentFrame = qmd2.AnimStartFrame(qmd2.CurrentAnimation)
D3DXMatrixLookAtLH matView, vCameraSource, PlayerPos, d3d.CreateVector(0, 1, 0)
d3d.Device.SetTransform D3DTS_VIEW, matView

Case 29 'left control
qmd2.CurrentAnimation = 2
qmd2.CurrentFrame = qmd2.AnimStartFrame(qmd2.CurrentAnimation)

Case 57 'space
qmd2.CurrentAnimation = 4
qmd2.CurrentFrame = qmd2.AnimStartFrame(qmd2.CurrentAnimation)
'D3DXMatrixLookAtLH matView, vCameraSource, vCameraTarget, d3d.CreateVector(0, 1, 0)
'd3d.Device.SetTransform D3DTS_VIEW, matView

Case 201 'page up
vCameraSource.Y = PlayerPos.Y + 1
D3DXMatrixLookAtLH matView, vCameraSource, vCameraTarget, d3d.CreateVector(0, 1, 0)
d3d.Device.SetTransform D3DTS_VIEW, matView

Case 209 'page down
vCameraSource.Y = PlayerPos.Y - 1
D3DXMatrixLookAtLH matView, vCameraSource, vCameraTarget, d3d.CreateVector(0, 1, 0)
d3d.Device.SetTransform D3DTS_VIEW, matView

Case 17 'w key
If bWireframe = False Then
bWireframe = True
d3d.Device.SetRenderState D3DRS_FILLMODE, D3DFILL_SOLID
bWireframe = False
End If

Case 1 'escape

End Select

End Sub
There is another procedure which it runs before the above sub.

Public Sub CheckKeyboard()
' CheckKeyboard - checks which keys have been pressed and raises
' an event to handle it.
Dim n As Long
Dim lKey As Long

'make sure the keyboard handler is running
If diDev_Keyboard Is Nothing Then Exit Sub
'get the list of pressed keys
diDev_Keyboard.GetDeviceStateKeyboard diState_Keyboard
'scan the entire list for pressed keys
For n = 0 To 255
If diState_Keyboard.Key(n) > 0 Then
lKey = n
RaiseEvent KeyDown(n)
End If
Next n

End Sub

Any help will be greatly appreciated.

Checking User Input

I'm having the following little problem, and I'm wondering if anyone
can help me.

I'm having a worksheet with the folowing columns.

Date - Town - Zip Code - Cust. No. - Visit Code - Start time - End time
- Time classification

This worksheet is filled in by employees who vist a numer of companies
each day.

The information about each visit is entered on one row in the sheet.

For example : The date of the visit, the town and zip code, the customer number, the kind of visit, the start and end time of each visit and the kind of time spent on this visit.

Now I want to check if all information is enterd correctly.

For example, is there an ":" between the hours and minutes, is the End time not before the Start time.

A check to see if both time items (Start and end) are filled in.

A way to pre enter data, for example if the code "FV" (First visit) is entered in the column "Visit code" the same code (FV) should also
be filled in automatically in the column "Time classification".

I guess this must be difficult (?) to program, but i woluld appreciate
if anyone could help me with this problem.

Best regards,

Frits Jager
(The Netherlands)

User Input String
hhm.....i dunno really how i can explain this.
What i have is a simple html builder i'm making, pointless really but still........
anyway when the user clicks the button to add bold text i use the code:

Text1.Text = Text1.Text + " <b>replace with text to go bold</b>"
What i was wondering is if a text entry box couild open up and the user type in there the text they wanted to go bold, then it added

Text1.Text = Text1.Text + " <b>WHATEVER USER INPUTTED HERE</b>"

User Input To Variables
I have created a form in which the user can specify where the program can save files, but how to I save that to a variable so when the program closes and re starts it stays the same?

User Input Problem
Does anybody know how i can limit a users input into a text box to a number of the type ##.##? I've tried using an input mask but at runtime i need the text box to say 00.00
The input mask will not allow this as well as the user to enter 0 as part of the number.

Is there a way of doing this with code? any help would be appreciated!

User Input Date Only
does anybody know how to restrict a users input into a text box a date of the format dd/mm/yyyy only? any help would be appreciated!

User Input And Store
How would i allow the user to input a piece of text into a field and then click on a button so it is stored and then displayed on the screen?

Check User Input

Just a newbe question. I want to check some userinput. The input must be <number>-<boolean>

Where <boolean> is 0 or 1



I have the following code and it is working fine, but I was wondering if there is an easier way to do this.

Dim Data As String
Dim L As String
Dim R As String
Dim I As Integer

Data = InputBox("Enter data")
I = InStr(1, Data, "-")
If I > 1 And I < Len(Data) Then
L = Left(Data, I - 1)
R = Right(Data, Len(Data) - I)

If R = "0" Or R = "1" Then
If IsNumeric(L) Then
'User input is valid
MsgBox "L = [" & L & "]" & vbCrLf & _
"R = [" & R & "]"
End If
End If
End If

User Input MessageBox
I feel really stupid today...

How do I go about creating a messagebox that asks for user input? And how do I store the value in a variable?

Saving User Input
what is the quickest way to save/remember user selections on a form(e.g. Check boxes, Radio buttons)?.

I want my program to remember what the user selected last time, also I want to have an OPTIONS/SETTINGS form where a user can customize a small number of things in the interface. How do I store these choices?

Do I have to create text files and save it?

Only Show User Last Input
If user want to add file, they first have to click cmdAdd and then fill the text box in form and click cmdSave button.Program will validate user input, so that it will not contain the same code in the database. Well it work until user clik Next or Prev button it still show user last input data in the program, not next or prev file.
And if I click Delete button it will prompt Run Time Error '3021':
Either BOF or EOF is true, or the current record has been deleted.
Request Operation requires a current record.

Some one can Help Me???

Private Sub Form_Load()
con.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=test"


rs.Open "Select * from data", con, adOpenDynamic, adLockOptimistic
End Sub

Private Sub cmdAdd_Click()
c = 1
End Sub

Private Sub cmdSave_Click()
rs.Filter = "code = '" & txtCode.Text & "'"

If c = 1 And rs.EOF Then
GoTo errmsg
End If

rs!code = txtKodeBrg.Text
rs!price = txtprice.Text
rs!Quantity = txtQuantity.Text
rs!Total = txtTotal.Text


Exit Sub
MsgBox "Enter Another Code"
End Sub

Private Sub cmdDelete_Click()
End Sub

Public Sub show()
txtCode.Text = rs!code
txtprice.Text = rs!price
txtQuantity.Text = rs!Quantity
txtTotal.Text = rs!Total
End Sub

Public Sub txtClean()
txtCode.Text = ""
txtprice.Text = ""
txtQuantity.Text = ""
txtTotal.Text = ""
End Sub

Private Sub cmdNext_Click()
If rs.EOF Then
End If
End Sub

Private Sub cmdPrev_Click()
If rs.BOF Then
End If
End Sub

Saving User Input
I'm abit new to the more advanced functions of VB.
Im currently using VB6, 2005 Express Edition.

Is there a simple way to code a button to set the text property of all the text boxes on the form to what ever the user has typed in (like save it into the file as the default) ?

OR if there isnt a simple way can you explain abit about a more complicated way of doing it?


Deny User Input

I have a textbox where the user can enter some text.

But what if I wanted some text to be denied entered into that form?

For example.. if I have a box where the user can either enter 1 or 2 and they enter 3, how could I make a MsgBox popup and say "Wrong Input!"?
Any idea?


Help With User Input Validation
I am quite new to Vb and need some help in validating the user input. I have already created a form and requested the user for there input using a text box. The input has to be in a specifc format, e.g. letter space and then a number. If the user enters something incorrectly then they should be given an error msgbox.
Here is the code I have so far:

Private Sub cmdClose_Click()

End Sub

Private Sub CommandButton1_Click()

Dim enter As Integer

If enter = 1 Then

MsgBox "hello"


MsgBox "error"

End If

End Sub

Private Sub Label1_Click()

End Sub

Private Sub TextBox1_Change()

End Sub

Private Sub UserForm_Click()
WindowState = 2
End Sub

It appears to me to be a problem witht the IF stmt and also the variable associated with getting the users input?

I would appreciate it if someone could give me some hints and tips, ideally modifyng the code above.

Calculating User's Input
I have a Text box and this code:

VB Code:
Private Sub Command1_Click()MsgBox Text1.TextEnd Sub

now... if the user enters into the text box "5*5", the message box says "5*5" instead of the result.. please tell me how to make the message box tell the result... also, is it possible to enter the global variables?

e.g. in the source code i define a global variable:

VB Code:
Dim blah as integerblah = 1024

now... please tell me how the user can enter "blah / 2" into the text box and the message box will return 512...

Thans in advance

User Input Within A Function

I am creating my own message boxes, but I am faced with the problem of not being able to pause the function to wait for the user's button press.

For example:

main form
msg 1, "you have made an error"

public function msg(msgtype as integer, msgtext as string) as integer

-load appropriate form buttons etc. here
-load and show form
-I want to be able to wait to see which button has been pressed here; this is my problem
-set 'msg' as the button number, return to main form

Thanks for any help.

Sql Adjustment For User Input
I am trying to allow the user to pick what they want to show from a database.

I use:

VB Code:
strsql = "Select '" & txtitems.Text & "' from Invoice;"

txtitems.text will actually equal * (all).

This brings up just on colomn in the ms flex grid field header expr1000 then it has many rows all with * in them.

When i replace the txtitems.text with *, it shows everything just as it should.

Is there a way that i can allow for the user to select the fields without giving me undesired effects????????

User Currency Input
I am trying to find the best way to force a user to enter a currency amount. I have tried using the maskedit box but I find it unfriendly. For instance when you press the period it doesn't automatically go to the decimal portion of the currency amount.
Is there a better way?

How To Send User Input Within Url ?
I want to make a button run a whois search to this url, where IP is this IP the user types into a text box, so i use shell,

who = Shell("C:Program FilesInternet ExplorerIEXPLORE.EXE", vbMaximizedFocus)

So how to i change this so that the value of text2 is actually used in the Url ?

Is There An API That Waits For User Input?
I am trying to simulate a green console display like old legacy systems. I provide the status of the program, and then also write questions that need the user's response before I move on to the rest of the program.

I don't want to use the regular VB windows (messagebox or input, etc.) but will use a multilined textbox for input and output.

Is there a way that I can stop the program, wait for the user to send a response, read his response and then move further with my program?

Is there some sort of API that does this? I saw some code on this forum for Console Classes but they were just too much for what i need.

Thanks for the help. I'm still in the process of brainstorming.

Pause User Input
I have a program that has a click event that kicks off a bunch of stuff, including reading from an mdb. If you click too many times, or double click, it can't read from access completely. Somehow it knows how many rows there are in the db but not the field values.

Is there a way to stop accepting input from the user - not accept clicks - until it has completed the procedure it is already working on? I don't want to use a timer because I never know how long it will take to read. I don't want to set the timer too long because it takes long enough to process already. Any ideas?

Copyright © 2005-08, All rights reserved