-
Custom Message boxes
i had an idea
custom message boxes
so i created a new form
put a 2 labels on it
and i have no idea to call it
at first i tried modifying form_load
like
form_load()
became
form_load(ttl as string, hder as string, mesag as string)
for title header and message
but it said it was illegal
then after snooping around my help files
------
Property Set msgbox(msag As String, ttle As String, hder As String)
msag = " GRGRRR you IDIOT, why can you not learn to count"
ttle = "idiot buster duo xeroes"
hder = ":-)"
End Property
msges.Form_Load
---------
didnt work
but maybe i didnt get the propierties correct
-----------
Sub Form_Load()
Property Get msgbox(msag As String, ttle As String, hder As String)
Label1.Caption = msag
Me.Caption = ttle
Label2.Caption = hder
End Property
End Sub
------------
how do i go about with this kinda thing
i want to declare a function
but when you have controls on other forms, they are not accessable from the
current
i have to define the propierties when i want to make the message box
and then get them when it loades msges form
-
Re: Custom Message boxes
something else i want to trie, but i really dont know how to do
declare a function
like, function dspmsg(headr as string titl as string mesag as string)
mseg.show
mseg.some other fuction
How do i paass those arguments to "some other function"
that is a part of another form
"meowmeow" <mewmew@xero00.com> wrote:
>
>i had an idea
>custom message boxes
>so i created a new form
>put a 2 labels on it
>and i have no idea to call it
>at first i tried modifying form_load
>like
>form_load()
>became
>form_load(ttl as string, hder as string, mesag as string)
>for title header and message
>but it said it was illegal
>then after snooping around my help files
>------
>Property Set msgbox(msag As String, ttle As String, hder As String)
>msag = " GRGRRR you IDIOT, why can you not learn to count"
>ttle = "idiot buster duo xeroes"
>hder = ":-)"
>End Property
>msges.Form_Load
>---------
>didnt work
>but maybe i didnt get the propierties correct
>-----------
>Sub Form_Load()
>Property Get msgbox(msag As String, ttle As String, hder As String)
>Label1.Caption = msag
>Me.Caption = ttle
>Label2.Caption = hder
>End Property
>End Sub
>------------
>how do i go about with this kinda thing
>i want to declare a function
>but when you have controls on other forms, they are not accessable from
the
>current
>i have to define the propierties when i want to make the message box
>and then get them when it loades msges form
>
-
Re: Custom Message boxes
meowmeow,
Just a simple comment. Most of us who frequent these boards and try
to help people are Professional, and would like to converse with someone
else using a REAL Name rather than a "cute" handle(I'm sure that you Mother
did not name you meowmeow). You will much more likely to get a helpful answer
if you identify yourself. At least that way we know that you are semi-serious.
Otherwise you asppear to be very childish, and many of us will not waste
our time. Just my humble opinion.
As to what you are trying to do, you need to read about creating ActiveX
controls with Visual Basic. This an advance topic and you would be well
advised to become very familiar with the Basics of VB before you attempt
to jump into building your own controls. The body of your question indicates
to me that you lack some very fundamental ideas about how Visual Basic works,
and without that basic knowledge, you will never be able to build your specialized
message boxes.
I would suggest the you purchase "Visual Basic 6 Developer's Handbook", by
Evangelos Petroutsos and Kevin Hough, ISBN 0-7821-2283-3, and then read chapter
11, "Building ActiveX Controls".
But do not read Chapter 11, until you have read and understood chapters 1
through 10, first.
Arthur Wood
"meowmeow" <mewmew@xero00.com> wrote:
>
>i had an idea
>custom message boxes
>so i created a new form
>put a 2 labels on it
>and i have no idea to call it
>at first i tried modifying form_load
>like
>form_load()
>became
>form_load(ttl as string, hder as string, mesag as string)
>for title header and message
>but it said it was illegal
>then after snooping around my help files
>------
>Property Set msgbox(msag As String, ttle As String, hder As String)
>msag = " GRGRRR you IDIOT, why can you not learn to count"
>ttle = "idiot buster duo xeroes"
>hder = ":-)"
>End Property
>msges.Form_Load
>---------
>didnt work
>but maybe i didnt get the propierties correct
>-----------
>Sub Form_Load()
>Property Get msgbox(msag As String, ttle As String, hder As String)
>Label1.Caption = msag
>Me.Caption = ttle
>Label2.Caption = hder
>End Property
>End Sub
>------------
>how do i go about with this kinda thing
>i want to declare a function
>but when you have controls on other forms, they are not accessable from
the
>current
>i have to define the propierties when i want to make the message box
>and then get them when it loades msges form
>
-
Re: Custom Message boxes
My comments about "cute" handles and your basic knowledge of how Visual Basic
works apply here also.
to declare a function:
Private Function MyFunction(FirstArg as Integer, SeconArg as String)
as String
' now you add some code to defien what the string the function should
evalute to, given the two inputs
MyFunction = Mid$(SecondArg,FirstArg,3)
End Fnction
A Function WILL ALWAYS have a Value, which it will return (and that value
will ALWYS be of some type). A function van also be declaredf as either Private
(which means that it can only be used in the module where the code actually
is located, or as Public, which means that it can be called from other modules
as well)
In the example you attempted:
Public Function dspmsg(headr as string, titl as string ,mesag as string)
as String
' you would add code here to evalute dspmsg from the arguments which
you supply when it is called
End Function
if this code is located in the module for Form1, but you want to call it
from the code in Form2:
in form2's module, you could have this line of code:
Caption = form1.dspmsg(Header,Title,Mesag)
But you really need to get some help with understanding the basics of how
Visual Basic works, and how you write the code.
Arthur Wood
"meuseo" same wrote:
>
>something else i want to trie, but i really dont know how to do
>declare a function
>like, function dspmsg(headr as string titl as string mesag as string)
> mseg.show
> mseg.some other fuction
>How do i paass those arguments to "some other function"
>that is a part of another form
>
>
>"meowmeow" <mewmew@xero00.com> wrote:
>>
>>i had an idea
>>custom message boxes
>>so i created a new form
>>put a 2 labels on it
>>and i have no idea to call it
>>at first i tried modifying form_load
>>like
>>form_load()
>>became
>>form_load(ttl as string, hder as string, mesag as string)
>>for title header and message
>>but it said it was illegal
>>then after snooping around my help files
>>------
>>Property Set msgbox(msag As String, ttle As String, hder As String)
>>msag = " GRGRRR you IDIOT, why can you not learn to count"
>>ttle = "idiot buster duo xeroes"
>>hder = ":-)"
>>End Property
>>msges.Form_Load
>>---------
>>didnt work
>>but maybe i didnt get the propierties correct
>>-----------
>>Sub Form_Load()
>>Property Get msgbox(msag As String, ttle As String, hder As String)
>>Label1.Caption = msag
>>Me.Caption = ttle
>>Label2.Caption = hder
>>End Property
>>End Sub
>>------------
>>how do i go about with this kinda thing
>>i want to declare a function
>>but when you have controls on other forms, they are not accessable from
>the
>>current
>>i have to define the propierties when i want to make the message box
>>and then get them when it loades msges form
>>
>
-
Re: Custom Message boxes
Define a public sub in the form for the custom message box. Show the form as
modal after initializing it.
Pulic Sub CustomShow (sMyTitle as String, sMyHeader as String, sMyCaption as
String)
Me.Caption = sMyTitle
Me.lblHeader.Caption = sMyHeader
Me.lblCaption.Caption = sMyCaption
Me.Show vbModal
Unload Me
End Sub
--
~~~
!ti timda I ,KO
..em deppals nocaeB sivaM
!draH
~~
C'Ya,
mrfelis@yahoo!com
meowmeow <mewmew@xero00.com> wrote in message news:3a49d317@news.devx.com...
>
> i had an idea
> custom message boxes
> so i created a new form
> put a 2 labels on it
> and i have no idea to call it
> at first i tried modifying form_load
> like
> form_load()
> became
> form_load(ttl as string, hder as string, mesag as string)
> for title header and message
> but it said it was illegal
> then after snooping around my help files
> ------
> Property Set msgbox(msag As String, ttle As String, hder As String)
> msag = " GRGRRR you IDIOT, why can you not learn to count"
> ttle = "idiot buster duo xeroes"
> hder = ":-)"
> End Property
> msges.Form_Load
> ---------
> didnt work
> but maybe i didnt get the propierties correct
> -----------
> Sub Form_Load()
> Property Get msgbox(msag As String, ttle As String, hder As String)
> Label1.Caption = msag
> Me.Caption = ttle
> Label2.Caption = hder
> End Property
> End Sub
> ------------
> how do i go about with this kinda thing
> i want to declare a function
> but when you have controls on other forms, they are not accessable from
the
> current
> i have to define the propierties when i want to make the message box
> and then get them when it loades msges form
>
-
Re: Custom Message boxes
i eventually solved the problem a few hours ago, before i came to the group
it is alot like mrfelis's solution
Private Sub cmdSave_Click()
Dim pathn As String
Dim Filen As String
pathn = Pathsave.Text
Filen = Fyln.Text
pathn = pathn & Filen
If pathn = "" Then
msges.Show
msges.setstuff " STUPIDO ", " STUPIDO DP20", "must enter
both fields , sowy fo da inconweenyense"
Pause 2
Exit Sub
End If
pathn = Pathsave.Text
Filen = Fyln.Text
pathn = pathn & Filen
Open pathn For Append Access Read Write As #1
Print #1, txtNotepad.Text
Close #1
End Sub
i realized i could call a function like that
form.function
Function setstuff(headr As String, titl As String, mesag As String)
heade.Caption = headr
fielde.Caption = mesag
msges.Caption = titl
End Function
-----pardon the confusing names
Im constantly afraid i will run into an error from using a reserved keyword
as a variable. heade = heade(as in the main title of the box), fyln(fyle
name), pathn = pathname
i tend to abbrievieate the nmes with alternate spellings
if they are pronounced , then the meaning is more apparent
if something i use is not involved in a function or sub or anything, i dont
give it a meaningfull name
everything else though
sorry for the multiple names,
any email address ending in xero00.com is myne
"mrfelis" <mrfelis@yahoo.NOSPAM.com> wrote:
>Define a public sub in the form for the custom message box. Show the form
as
>modal after initializing it.
>
>Pulic Sub CustomShow (sMyTitle as String, sMyHeader as String, sMyCaption
as
>String)
> Me.Caption = sMyTitle
> Me.lblHeader.Caption = sMyHeader
> Me.lblCaption.Caption = sMyCaption
> Me.Show vbModal
> Unload Me
>End Sub
>
>--
>~~~
> !ti timda I ,KO
>..em deppals nocaeB sivaM
>!draH
>~~
>C'Ya,
>mrfelis@yahoo!com
>meowmeow <mewmew@xero00.com> wrote in message news:3a49d317@news.devx.com...
>>
>> i had an idea
>> custom message boxes
>> so i created a new form
>> put a 2 labels on it
>> and i have no idea to call it
>> at first i tried modifying form_load
>> like
>> form_load()
>> became
>> form_load(ttl as string, hder as string, mesag as string)
>> for title header and message
>> but it said it was illegal
>> then after snooping around my help files
>> ------
>> Property Set msgbox(msag As String, ttle As String, hder As String)
>> msag = " GRGRRR you IDIOT, why can you not learn to count"
>> ttle = "idiot buster duo xeroes"
>> hder = ":-)"
>> End Property
>> msges.Form_Load
>> ---------
>> didnt work
>> but maybe i didnt get the propierties correct
>> -----------
>> Sub Form_Load()
>> Property Get msgbox(msag As String, ttle As String, hder As String)
>> Label1.Caption = msag
>> Me.Caption = ttle
>> Label2.Caption = hder
>> End Property
>> End Sub
>> ------------
>> how do i go about with this kinda thing
>> i want to declare a function
>> but when you have controls on other forms, they are not accessable from
>the
>> current
>> i have to define the propierties when i want to make the message box
>> and then get them when it loades msges form
>>
>
>
-
Re: Custom Message boxes
From everything that you have posted here recently, it is very apparent that
you are completely self-taught. For that I commend you, as you seem to have
some intersting ideas. However, there will come a time (probably very soon)
when you should begin to think seriuosly about either or both of these ideas:
1) get hold of a good book on VB (Peter Wright's Beginning Visual Basic 6,
or if you are up to more of a challenge, Visual Basic 6 Developer's Handbook
by Petroutsos and Hough)
2) adopt a naming convention, for your variables. Then you avoid the potential
conflict with reserved words. It is generally accepted that a varaible should
be named with a two or three letter prefix which idetifies the type of the
variable:
str String
int Integer
lng Long-Integer
sng Single
obj Object
cmd Command Button
txt TextBox
lbl Label
frm Form (or possibly Frame)
cbo Combo-box etc
you get the idea. This will assist others in trying to read your code and
offer suggestions, and will assist you in trying to write codfe which doesn't
cause conflicts with VBs set of reserved words.
A second very minor point:
in your recent post you have this code:
Function setstuff(headr As String, titl As String, mesag As String)
heade.Caption = headr
fielde.Caption = mesag
msges.Caption = titl
End Function
Strictly speaking that should be a Sub procedure. Subs do not return a value
as a result, while functions do. In C or C++ all procedures are treated
as functions, it is just that some C/C++ functions have a return type of
void (meanning they don't return a value). These would be the equivalent
of VB Subs. As I said, it is a minor point, and your code will work as you
have written it.
Arthur Wood
"XerosAqua" <XerosAqua@hotmail.com> wrote:
>
>i eventually solved the problem a few hours ago, before i came to the group
>
>it is alot like mrfelis's solution
>Private Sub cmdSave_Click()
>Dim pathn As String
>Dim Filen As String
>pathn = Pathsave.Text
>Filen = Fyln.Text
>pathn = pathn & Filen
>If pathn = "" Then
>msges.Show
>msges.setstuff " STUPIDO ", " STUPIDO DP20", "must enter
>both fields , sowy fo da inconweenyense"
>Pause 2
>Exit Sub
>End If
>pathn = Pathsave.Text
>Filen = Fyln.Text
>pathn = pathn & Filen
>Open pathn For Append Access Read Write As #1
>Print #1, txtNotepad.Text
>Close #1
>
>End Sub
>
>i realized i could call a function like that
>form.function
>
>Function setstuff(headr As String, titl As String, mesag As String)
>heade.Caption = headr
>fielde.Caption = mesag
>msges.Caption = titl
>End Function
>
>
>
>
>
>-----pardon the confusing names
> Im constantly afraid i will run into an error from using a reserved
keyword
>as a variable. heade = heade(as in the main title of the box), fyln(fyle
>name), pathn = pathname
>i tend to abbrievieate the nmes with alternate spellings
>if they are pronounced , then the meaning is more apparent
>if something i use is not involved in a function or sub or anything, i dont
>give it a meaningfull name
>everything else though
>sorry for the multiple names,
>any email address ending in xero00.com is myne
>
>"mrfelis" <mrfelis@yahoo.NOSPAM.com> wrote:
>>Define a public sub in the form for the custom message box. Show the form
>as
>>modal after initializing it.
>>
>>Pulic Sub CustomShow (sMyTitle as String, sMyHeader as String, sMyCaption
>as
>>String)
>> Me.Caption = sMyTitle
>> Me.lblHeader.Caption = sMyHeader
>> Me.lblCaption.Caption = sMyCaption
>> Me.Show vbModal
>> Unload Me
>>End Sub
>>
>>--
>>~~~
>> !ti timda I ,KO
>>..em deppals nocaeB sivaM
>>!draH
>>~~
>>C'Ya,
>>mrfelis@yahoo!com
>>meowmeow <mewmew@xero00.com> wrote in message news:3a49d317@news.devx.com...
>>>
>>> i had an idea
>>> custom message boxes
>>> so i created a new form
>>> put a 2 labels on it
>>> and i have no idea to call it
>>> at first i tried modifying form_load
>>> like
>>> form_load()
>>> became
>>> form_load(ttl as string, hder as string, mesag as string)
>>> for title header and message
>>> but it said it was illegal
>>> then after snooping around my help files
>>> ------
>>> Property Set msgbox(msag As String, ttle As String, hder As String)
>>> msag = " GRGRRR you IDIOT, why can you not learn to count"
>>> ttle = "idiot buster duo xeroes"
>>> hder = ":-)"
>>> End Property
>>> msges.Form_Load
>>> ---------
>>> didnt work
>>> but maybe i didnt get the propierties correct
>>> -----------
>>> Sub Form_Load()
>>> Property Get msgbox(msag As String, ttle As String, hder As String)
>>> Label1.Caption = msag
>>> Me.Caption = ttle
>>> Label2.Caption = hder
>>> End Property
>>> End Sub
>>> ------------
>>> how do i go about with this kinda thing
>>> i want to declare a function
>>> but when you have controls on other forms, they are not accessable from
>>the
>>> current
>>> i have to define the propierties when i want to make the message box
>>> and then get them when it loades msges form
>>>
>>
>>
>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|