dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 3 of 4 FirstFirst 1234 LastLast
Results 31 to 45 of 52

Thread: Convert Access database to VB project

  1. #31
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    label1.caption = "line1" & vbcrlf & "line2" & vbcrlf & ...

    vbcrlf = vbcr + vblf [line feed]
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  2. #32
    Join Date
    Dec 2006
    Posts
    49
    Is there any way i can find out which frame is currently visible in the application. i need the array number of the frame to optimize the program for back and next button.

    I have written this code for next and back button:

    Private Sub cmdNext_Click()
    Dim i As Integer
    i = frame.?????????????????????????????????????????
    If frame(i).Visible = True Then
    i = i + 1
    End If
    ShowFrame i

    If i >= 0 Then
    cmdBack.Visible = True
    End If
    End Sub

    Public Function ShowFrame(ByVal i As Integer)
    frame(i).Visible = True
    If i > 0 Then
    frame(i - 1).Visible = False
    End If
    End Function


    please help.

  3. #33
    Join Date
    Dec 2006
    Posts
    49
    more precisely can i find what is the index of the currently visible frame and in which data type i can store that

    'some code to find out the currently visible frame ?????
    'dim i as data type? ???????????
    i=frame(index)
    ' code for the next button

  4. #34
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    let me give u a small update in your code may it help u :

    Code:
    'declarations:
    Dim i as integer
    '---------------
    Private Sub cmdNext_Click()
    frame(i).Visible = True
    frame(i - 1).Visible = False 'i +1 for back
    i = i + 1 ' i = i - 1 for back
    if i = 20 then 'if i = 0 for back
     cmdNext.enabled = false 'cmdback
    else 
     cmdNext.enabled = true 'cmdback
    end if
    end sub
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  5. #35
    Join Date
    Dec 2006
    Posts
    49
    My question is how to find out i ?
    that is the index of currently visible frame.

  6. #36
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    okey man I have told u how to find it by coding method

    the solution is to put i as public variable and it will contains the visible frame all time , otherwise u can make i static variable in any of your functions .
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  7. #37
    Join Date
    Dec 2006
    Posts
    49
    Can you explain what value of I will be saved when I write

    Dim i as Integer
    Frame(i).Visible = True

  8. #38
    Join Date
    Dec 2006
    Posts
    49
    I need the value of i for other functions, such as changing the caption of the labels in different forms. what i have to wright to get the value of i

  9. #39
    Join Date
    Dec 2006
    Posts
    49
    Well i have solved that problem!

    Now can any one tell me how to handle this error.
    i have a number of text files which contain data for specific values.
    i have given every constrains possible so that no user can enter alphabet or leave a textbox empty. but if the user enters arbit values then my program will generate a file name and it tries to open the file from the concerned folder.

    I have the file name . Now how can i check if any file with that file name existas or not. if they don't exist i want to give a msg that "file doesn'ty exists in database"
    + "try again!!".

    how can i do this?

  10. #40
    Join Date
    Dec 2006
    Posts
    49
    I wrote this program :

    On Error Resume Next
    Cr = FindCr(Gh, Cp, Fn) ' this is the function which opens text file from for input.

    If Error <> 0 Then
    MsgBox "error"
    Exit Sub
    End If

    but it's giving error every time dont know why?
    can you help?
    Last edited by tava.amitava; 12-30-2006 at 07:06 AM.

  11. #41
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    first of all check if your function haven't errors ..

    if err <> 0 then .. or if err.number <> 0 then ...

    about i I told u to make it public , and if u wish u can make a string of restricted charcters and check over them to solve your error problem .
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  12. #42
    Join Date
    Dec 2006
    Posts
    49
    thanks Mr.Amahdy
    That err.number<>0 works fine.

  13. #43
    Join Date
    Dec 2006
    Posts
    49
    First of all I want to wish you all a very happy new year.

    Now my question is "is there any way to clear the debug window each time i run the application ?"

  14. #44
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    I don't think so , but sometimes you can make something like that on the load of project :

    debug.print vbcrlf & vbcrlf & vbcrlf
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  15. #45
    Join Date
    Dec 2006
    Posts
    49
    I am having a problem which i don't understand why is it happening?

    As I said before that I need to open a file to read data from that and the file name is created by the program. i.e if
    Gh=4
    Cp=0.75
    Then the file name will be
    Fname=App.Path & "\Data\Gh" & Cstr(Gh) & "_" & "Cp" & Cstr(Cp)

    So Fname becomes ....\Data\Gh4_Cp0.75

    Now the problem is if that file is not exists in the Data folder then the program will generate an error.

    To overcome this problem I have written this:


    '==============================================================
    On Error Resume Next
    Cr = FindCr(Gh, Cp, Fn)

    If Err.Number <> 0 Then
    MsgBox "Sorry ! There is some error. The reason can be either" & _
    vbCrLf & "1. Data for this ship is note yet updated." & _
    vbCrLf & "2. The type of ship is out of range for this method" & _
    vbCrLf & "3. There must be some mistake in input" & _
    vbCrLf & "Check your data properly and enter the data cautiously.", vbExclamation, "Error"
    Exit Sub
    End If

    '===============================================================

    Here FindCr(Gh,Cp,Fn) is a function which opens a file of name(Gh.._Cp..) as explained before.

    The problem is when i click the calculate button of my application with a data for which the file is not exists it shows an error. Then when I give input for which the file exist then also it gives some error msg.

    Then I have to close the program and then when i reopen it and give the correct inputs( i.e file exists) then it gives me result.

    So how to improve this? I want to give various inputs and check whether the file exists or not without closing the application.

    i am sure you will help.
    thanx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center