Results 1 to 7 of 7

Thread: some problem need help as i just started VB.net

  1. #1

    Thread Starter
    Fanatic Member khalik_ash's Avatar
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    724

    Thumbs up some problem need help as i just started VB.net

    i have some problem and i am not sure with my approach. can any one help me out.

    my solution has Sub Main as startup
    Code:
    Module Mod_Main
        Public Sub Main()
            g_strAppDir = Application.ExecutablePath
            Dim frm As New Frm_Logon()
            frm.Show()
            Application.Run()
        End Sub
    ......
    when i use only frm.Show() disapper after show. so i have used Application.Run() what can be the problem and using Application.Run() is correct.?

    now we can create Dataset in diff way i have choose one

    i have created .xsd and .vb file using vs for dataset.
    i did by adding a dataset component and defining the structure and relation
    i have a sub Init_DataSet() for loading the data... but seem to have some problem is my approach correct...

    Code:
    Public Sub Init_DataSet()
            Try
                Cn.Close()
                Dim OIT_Folder_SelectCmd As New SqlClient.SqlCommand("select * from OIT_FOLDER", Cn)
                Dim OIT_Folder_UpdateCmd As SqlClient.SqlCommand
                Dim OIT_Folder_Adapter As SqlClient.SqlDataAdapter
                Dim OIT_File_SelectCmd As New SqlClient.SqlCommand("select * from OIT_File", Cn)
                Dim OIT_File_UpdateCmd As SqlClient.SqlCommand
                Dim OIT_File_Adapter As SqlClient.SqlDataAdapter
                Dim OIT_Permissions_SelectCmd As New SqlClient.SqlCommand("select * from OIT_Permissions", Cn)
                Dim OIT_Permissions_UpdateCmd As SqlClient.SqlCommand
                Dim OIT_Permissions_Adapter As SqlClient.SqlDataAdapter
                OIT_Folder_Adapter.SelectCommand = OIT_Folder_SelectCmd
                Cn.Open()
                OIT_Folder_Adapter.Fill(g_Ds, "OIT_Folder")
                'OIT_File_Adapter.SelectCommand = OIT_File_SelectCmd
                'OIT_File_Adapter.Fill(g_Ds, "OIT_File")
                'OIT_Permissions_Adapter.SelectCommand = OIT_Permissions_SelectCmd
                'OIT_Permissions_Adapter.Fill(g_Ds, "OIT_Permissions")
            Catch e As Exception
                MsgBox(e.Message)
            End Try
        End Sub
    and when i execute the Init_DataSet() sub i got some waring not sure what are there....

    Could not copy temporary files to the output directory.
    The file 'OrganiseIT.NET.exe' cannot be copied to the run directory. The process cannot access the file because it is being used by another process.
    The file 'OrganiseIT.NET.pdb' cannot be copied to the run directory. The process cannot access the file because it is being used by another process.

    [/CODE]

  2. #2

    Thread Starter
    Fanatic Member khalik_ash's Avatar
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    724

    Thumbs up


    i make is simple

    if i start my app from sub main why does frm.Show() does not work...


    why shd i add Application.Run()

    dataset i was able to handle..... in difff.. just for info

    which is a better way to use dataset...runtime add or define in design or add dataset component.

  3. #3
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    I dont remember the exact command, but I think it is form2.ShowModal(). That will show your form and not cause the application to stop running.

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I've tried this and worked fine (without application.run)
    VB Code:
    1. Module Module1
    2.     Public Sub Main()
    3.         Dim frm As New Form()
    4.         frm.ShowDialog()
    5.     End Sub
    6. End Module

  5. #5
    Fanatic Member rudvs2's Avatar
    Join Date
    Mar 2001
    Location
    NZ
    Posts
    935
    Question? Why use sub main to start the application?

    why not declare form1 as the startup object

    then in either the new constructor or in form_Load event branch off to execute any functions or subs you need to execute to complete the initialisation of the form


    I have often found that keeping things simple is the best answer to any problem (often not always)

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    What you are trying to do in your proj is most suitably for Console apps ! So build your proj as a windows application !
    Last edited by Pirate; Mar 27th, 2003 at 10:04 PM.

  7. #7

    Thread Starter
    Fanatic Member khalik_ash's Avatar
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    724
    well thanks a lot guys....
    i am connecting in submain and next is my login screen and then come main windows. the flow is like this...

    one at a time... first come first bases


    Negative0 --- form2.ShowModal
    if i use showmodal then if i login is complete and i need to show frmmain. then i need to close the login form then whole app closes... so cannot use showmodal


    Pirate --- my early say the same...

    rudvs2 -- i need t have a submain in my solution. so cannot change it...

    if i use application.run and to exit applican.exit it work fine... but some times the applican.exe in bin folder still in use after the app close...



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width