Major unsolvable problem

Status
Not open for further replies.
When you drag the timer into your form, set the interval of timer to 3000 cause you 3 seconds right,set enabled to true.
In the code: when timer reaches 3 seconds you have to turn it off by putting enabled = false so it wont continue, otherwise you would get a new form shown every 3 seconds instead of once.
 
Oh, now when i reread your post i think i get what you ask and how would it tick. The tick event will be executed when timer reaches the interval. So when it ticks after reaching the interval you have to disable it so it wont tick again and show another form.
 
cywizz it isnt how i wanted it


i got a mainform


and a font form



mainform has a menu
user clicks on it
and it opens up the font form



on the font form


theres a browse button


once the user selects the font from the browse button whcih opens a font dialog


then they get a preview and the fonts name in a label on the font form


then they can click apply


and the mainforms font will be changed to wateva they desire
 
wow its rite!!!! thats how i wanted it


thx


im not getting how u get the _parent thing and _selected font tow rokwhere u declare it?
 
hmm i copied the class variables in
and the little code for the apply button in my project
it aint working too well
:S
i get object reference error
 
I assume you're getting the error on the click event of the apply button..... Have you created the new constructer with the parent reference, and did you set the passed in form to the local _parent variable?
Try to understand what I did, rather than copying the code....Once you understand these concepts(constructors/overloading/object refs) you will find it a lot of fun, and you never will want to go back to vb6 :o
 
i still am not understanding it too well read it over and over

tried to replicate it first to get it working

didnt work

copied region constructor

and class variables and also bounded it by the region events
 
You cant just copy the example code and expect it to work. Understand my example in context of yours, and apply the best solution based on that.

btw, you can't just copy the events, because I'm using my own control names... It looks like the events isn't firing... try to step through your code
 
Ok, forget about regions... regions are just a way of grouping your code (part of documentation...)
Step through your code... that is the ONLY way you can determine where and what the problem is...
 
i see zero errors wrong with my code



stepped through it all
went through the windows generated form code



this is the code for the font form


Visual Basic:
#Region "Constructor"
    Public Sub New(ByVal parent As Form)
        'fire other constructor
        Me.New()
        'set the module level variable
        _parent = parent
    End Sub

#End Region
#Region "Class Variables"

    Private _parent As Form
    Private _selectedFont As Font

#End Region

#Region "Events"
    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click

        Me.Close()

    End Sub

    Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click


        fntAppBase.ShowDialog()
        _selectedFont = fntAppBase.Font
        lblPreviewBox.Font = _selectedFont
        txtFontSel.Text = _selectedFont.Name


        btnApply.Enabled = True


    End Sub

    Private Sub btnApply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnApply.Click


        _parent.Font = _selectedFont



    End Sub

    Private Sub frmAppBaseFont_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        _parent.Font = _selectedFont
        Me.Close()
    End Sub
#End Region

End Class
 
Last edited by a moderator:
hmm i copied the class variables in
and the little code for the apply button in my project
it aint working too well
:S
i get object reference error
so where does the error occur? The only problem I see is when the cancel button was clicked on the fontdialogbox (_selectedFont will be nothing)
 
ok i finally got it

it was all the main forms fault


the dim frmfnt as new frmfont ()


i missed the (me) out


wat does that do? the me
 
It passes the mainforms reference (me) into the fontform (via the constructor). This reference is then set to the variable: _parent.
Read up on constructors and overloading, it will explain it better.
Cheers!
 
thanks i got most of the box underway one last error free thing i need to do is
checking the cancel button


say the font form is loaded

and the user opens the font dialog they selected a font and then clicked cancel and clicked on OK it applied still

:S....


how do i control the cancel button so it does nothing
 
I'm going to draw the line here... this problem should be solved by even the novice of vb6 developers.
I do suggest, as divil did, to get yourselve a proper vb.net book. I used, and recommend, Professional VB.NET - ISBN 1-861004-97-4
Cheers!
 
Status
Not open for further replies.
Back
Top