|
Verify that all your controls have an appropriate TabStop value and that their TabIndex has the correct order you expect. There are no know problems with TabStop in Windows Forms.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ive never used Visual Basic 6.0 before so i have very little knowledge on how to best do certain operations. I want the user to enter a value into a text field. This string can be anything but id like a number. Next i want to convert the string to a number and do some calculation on it (lets say input + 2).
Now in a later form i want to check and see if the value that was input earlier was a number or not before the conversion. If it was 11 for instance then i want to display "13" in a label. If it was anything besides a number (float or integer) i will display "Error" in a label.
What i did was create a global string variable named aInput. In the form where this value is input into a text box (txtInputA) i used aInput = Val(txtInputA.Text) to make the inputted string a number. This helps out the strings that are actually numbers, however it messes up because it makes a character string 0, so instead of getting an error later i'll get 2.
Example Of What I Want:
User inputs 3...........later on will display 5
User inputs 0...........later on will display 2
User inputs c76e........later on will display error
My guess is that there is a simple way to do this, or that im doing this in a very inconvenient method, but this was all i could do with my knowledge of this language.
|
|
|
|
|
In vb6 you can use the function IsNumeric() to determine whether a string can be converted into numeric values or not. It returns boolean True/False.
Hope it helps!
Edbert P.
Sydney, Australia.
|
|
|
|
|
The VB6 Numeric function has a shortcoming that I can't recall just now. I think it may parse a string like "12 34 56" that contains spaces automatically, and return 12 to you. Something like that.
Anyway, over the years I've found that you can't give a user too much information when it comes to error messages. Sometimes its just late and they can't tell a 0 from a o, or a 1 from a l. You're code knows exactly what the problem is, so you might as well be precise in your error message. Here's the routine I use.
Public Function Numeric(ByVal sNum As String, ByRef sErrMsg As String, _
Optional sOtherLegalChars As Variant, _
Optional vIncludeValidCharMsg As Variant) As Boolean
Const sValidDigits = "0123456789"
Dim sValidChars As String
Dim i As Integer
If IsMissing(sOtherLegalChars) Then sOtherLegalChars = ""
sValidChars = sValidDigits & sOtherLegalChars
If IsMissing(vIncludeValidCharMsg) Then vIncludeValidCharMsg = True
' Return error message only if a problem is found.
' Caller will get a true AND an empty errMsg string.
' or
' will get False AND an error message in the errMsg String.
sErrMsg = ""
If Len(sNum) = 0 Then
Numeric = False
sErrMsg = "Numeric value is missing or empty. Numeric digits were not found. [E0203262000]"
Exit Function
End If
For i = 1 To Len(sNum)
If InStr(sValidChars, Mid(sNum, i, 1)) = 0 Then
Numeric = False
sErrMsg = "The value " & quote(sNum) & " contains the non-numeric character " & _
quote(Mid(sNum, i, 1)) & " in position " & CStr(i) & ". [E0203262001]" & _
IIf(vIncludeValidCharMsg, vbCrLf & "The following are the only valid characters you can use: " & quote(sValidChars), "")
Exit Function
End If
Next i
On Error Resume Next
Dim L As Long
L = CLng(sNum)
Const vbOverflowErr = 6
If Err.number = 0 Then
Numeric = True
ElseIf Err.number = vbOverflowErr Then
sErrMsg = "Value " & quote(sNum) & " is too big. the biggest number allowed is about 2 billion. [E0301152200]"
Numeric = False
Else
sErrMsg = "Value " & quote(sNum) & " is not numeric [E03011522010]. The Microsoft error message is " & quote(Err.Description)
Numeric = False
End If
On Error GoTo 0
End Function
|
|
|
|
|
I'm sorry that I could not understand your question. But if I guest I think you want to know how to work with each control on the form. You might need the reference for each control. If you want to learn about the reference for each control try to check here[^], and let me know if it match what you need or not.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Ehmm.. not to work with each control.
Okay, maybe I should explain my project.
I have a main form with a main menu. From this
menu I want to load a 'Form' that shows data from an Access database.
This 'Form' is a User Control designer.
But I cant find any information on how to open my UC designers
in my main form. I have tried to inherit with System.Windows.Forms.Form
which opens a new window with the UC designer loaded.
But I don't want this to happen.
I want my UC designer to be loaded directly in my main form. Not
open it in a new window.
This is how my menu code looks like to open my UC designer.
(Possibly its wrong to use showdialog() and or show() )
<br />
':: frmMain.vb ::<br />
Private Sub mnuItemNews_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuItemNews.Click<br />
Dim ucFrm As New ucnews<br />
ucFrm.ShowDialog(Me)<br />
ucFrm.Dispose()<br />
End Sub<br />
And in my code for the UC designer I have an inherit to system.windows.forms.form.
Like this...
<br />
':: ucnews.vb ::<br />
Public Class clsNews<br />
Inherits System.Windows.Forms.Form<br />
'some code...<br />
End Class<br />
I hope you understand my question here! it's marked with bolded text
About my post yesterday!
Yesterday I tried to find information about UC designers.
But all papers, tutorials and guidelines made me confused because
they described User Controls as it was the designer form!
They never mentioned the User Control designer and how to use it within your
project.
|
|
|
|
|
[not sure if this most appropriate place to post, but..]
background:
i am working on a, mostly, basic mp3 player, so its functionality is exactly how i want, not how M$, etc, thinks it should be (just a personal player for fun). i am, however, using the Windows media player COM component (sry if terms incorrect). i dont use the visual one though, i declare a player in code using "... as new WMPLib.WindowsMediaPlayer()", and create my own gui. and if it matters: it automatically put the DLLs AxInterop.WMPLib and Interop.WMPLib into the bin folder for my project... also, i downloaded the WMP.10.SDK, which its using.
quick question:
as of now, my mp3 player [basic functionality] uses anywhere from 15-24mb ram. i was wondering if there is a less memory-intensive mp3 control like this that i could use? [instead of WMP]
update: sry, im using VB.net. i checked out the winAmp site, but could only find sdk for c/c++.
input appreciated, thanks.
------------------------
Jordan.
III
|
|
|
|
|
Dear All
Does anybody know if it is possible to create functon in a dll with vb and call it the same way as you call a function in a c++ dll?
Thanks
Henka
|
|
|
|
|
VB6 can only make COM .DLL's. It can't make a library .DLL like C++ can.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Add Dll in Reference
Import This Dlll Name Space in Module /Form
Example:
ccsMsgBox is a Dll Complined In Vb.6
Inlist is Function
Imports ccsmsgBox.Class1
Module M1
Inlist(.....)
End Module
|
|
|
|
|
I am currently building a mud client for fun and amhaving some problems with the interaction between the command entry textbox and the main textbox.
it breaks down like this i have a regular one line textbox at the bottom of the form. i have a multiline rich textbox in a tab control at the top of the form. i currently have the tabcontroll1_keypress event checking for the return key (Asc(e.KeyChar) = 13) then taking the text in the command box and putting it in the rich textbox. now i have bunch of other issues but mainly whats bothering me is every time i press enter the computer makes a noise. that windows set noise like if you try typing where you cant (like typing into a read only box). how can i make it stop beeping at me?
i have accepts return to true for the entry box and the form has no accept or cancel button set.
|
|
|
|
|
Try adding e.Handled = True at the end of the keypress event.
|
|
|
|
|
hi all to make a program which i can connect to the outlook through it and make a tree on my form the have inbox, deleted, sent, i want to display all the emails with their attachments to be able to save them on my pc on a specified folder not the personal one which i sprecified in the outlook, i use VB6.0 i need a code could any one help me.
Thanks alooooooooooooot
Thanks alot
Metal Man
|
|
|
|
|
Try to check the information from here.[^]
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
hi i visited this site but i didnt find any thing in it which i look for, could u please send me a code if u have
Thanks alot
Metal Man
|
|
|
|
|
we can send a file using file streams but how to send a folder ??
what is the code for that..?
|
|
|
|
|
You'll have to write the code to send each file individually. There is no way to send an entire folder all at once.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a 32x32 256 color cursor that I want to add to a VB resource file. The problem is that when it gets added, it changes the entire cursor to black. Any ideas?
What I would really like to do is to save an icon file in the resource. If anybody knows how to do this also, it would be greatly appreciated.
Thanks,
Tim
|
|
|
|
|
Have you tried to use the cursor when your application is running? I have no much idea about that but make sure that your icon file is originally create with the program that create icon (I mean don't change the file extension from the other file). Check your monitor color... to make sure that everything is running properly. The best idea is find any machine that have VB6 and load any cursor file. If it work fine then copy the cursor file to the machine that have a problem and test it, and vice versa.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
I hve a text box in my projet where user has to input Lastname.
The first character of the the last name shld be upper case.
Also i shld check wheater the input is alphabet.is there anything like isAlphabetic function in the vb.net
|
|
|
|
|
I don't think there is any function in .net which can convert string to proper case and to check validation try creating ur own function which can validate input by grabbing keyascii on keypress event.
|
|
|
|
|
There is no isAlphabetic function anywhere. You'll either have to write your own where the function will go through the string, character by character, and verify that it is an alphabetic character, or you could probably use a Regular Expression to verify that it is in the proper format. I'm far from an expert on Regular Expressions, so I don't know what the expression string would look like.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You have to write your own code. In my opinion you should write the code as the following concept.
1. Write the code in the KeyPress or KeyCode event to check whether the textbox is blank or not.
2. If the textbox is blank, then any letter between a to z have to plus with 32 (I mean the ascii code of that letter must pluse with 32, maybe 32, try to check in the ascii code table). Then the small letter between a to z will display in capital letter A to Z .
3. If the textbox is not blank, then don't do anything.
Try to do it and wish you good luck.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
I don't know if this is the right forum but I have a question about microsoft script control (msscript.ocx). I need to call scripts (VBS,JS...) from my app (C++ or whatever). I wonder if msscript.ocx is the right tool for that. Is there a more supported by Microsoft API for that?
They talk a lot about Scripting host but in terms of writing the scripts, not how to call them.
Thanks a lot!
|
|
|
|
|
Hi all,
I use DDE with API and it runs fine with texts. Now I need to "transfer" a picture from my app to MS Word. I have a picture in the PictureBox, and I need to move it to a ByteArray.
How may I do that ?
Best Regards
Christian
|
|
|
|