Results 1 to 27 of 27

Thread: Some Explanation with printing table in a one row

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Some Explanation with printing table in a one row

    Can anyone tell me why the table is not comming of any number in a one row.
    instead of one Column.Kindly find the attachment also.
    Code:
    Private Sub Form_DblClick()
    Dim x As Integer, m As Integer, s As Integer, calc As Integer
    m = InputBox("Enter a no")
     For x = 1 To 10
      s = x * m
      Print s   '??s why this is not working for printing in one line.
      Next
         
    End Sub
    Last edited by firoz.raj; May 30th, 2011 at 02:09 PM.

  2. #2
    Lively Member
    Join Date
    Feb 2010
    Posts
    85

    Re: Some Explanation with printing table in a one row

    put a comma ',' or semicolon ";" after print statement:
    Code:
    Print s;

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Some Explanation with printing table in a one row

    ok .when after loading the form it shows a table in a one line.but after little second times. table get invisible from the form.can you tell me why it gets invisible from the form.after some seconds.Kindly let me know the idea.Any help would
    be highly appreciated.
    Code:
    Private Sub Form_DblClick()
    Dim x As Integer, m As Integer, s As Integer, calc As Integer
    m = InputBox("Enter a no")
     For x = 1 To 10
      s = x * m
      Print s;
      Next
         
    End Sub
    Last edited by firoz.raj; Feb 3rd, 2010 at 12:10 AM.

  4. #4
    Lively Member
    Join Date
    Feb 2010
    Posts
    85

    Re: Some Explanation with printing table in a one row

    I'm not exactly sure what you mean but I am guessing that the numbers are disappearing on you. They are either being printed off the right hand side of the form or they are disappearing when you minimize the form.
    You can change the code to keep each set of 10 numbers on its own line by simply adding a print after the loop:
    Private Sub Form_DblClick()

    Code:
    Dim x As Integer, m As Integer, s As Integer, calc As Integer
    m = InputBox("Enter a no")
     For x = 1 To 10
      s = x * m
      Print s;
      Next
      print   ' this statement will cause the next print statement to print on a new line
    End Sub
    If it is disappearing because of minimizing the form you can change the forms AutoRedraw property to true.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Some Explanation with printing table in a one row

    you just paste this code in your dbl click or click code window.and just load the form.when you will dbl click just put any no.and it will be print.just see some seconds .you will see what i am talking about.kindly just paste the code
    in you double_click event.and let me know why it gets invisible after some seconds.Any help would be highly appreciated.
    Code:
    Private Sub Form_DblClick()
    Dim x As Integer, m As Integer, s As Integer, calc As Integer
    m = InputBox("Enter a no")
     For x = 1 To 10
      s = x * m
      Print s,
      Next
      Print
     End Sub
    Last edited by firoz.raj; Feb 3rd, 2010 at 03:52 AM.

  6. #6
    Lively Member
    Join Date
    Feb 2010
    Posts
    85

    Re: Some Explanation with printing table in a one row

    I did copy and paste the code into Vb. And I did it again just to be sure. The printed text did not disappear. And it won't disappear by an means I can think of. There must be something else in your project that is causing this to happen.

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Some Explanation with printing table in a one row

    i want if user issue 4.then it show the table of 1,and table of 2,table of 3 and table of 4.if user issue 3 then it show the table of 1,table of 2 and table of 3.means .can you tell me the way .
    Code:
    1*1=1
    1*2=2
    ...
    ...
    1*10=10
    
    4*1=4
    4*2=8
    ...
    ...
    4*10=40

  8. #8
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Some Explanation with printing table in a one row

    Maximize the form and then doubleclick on it...
    Code:
    Option Explicit
    
    Private Sub Form_DblClick()
    Dim x As Integer, m As Integer, s As Integer, i As Integer
    m = InputBox("Enter a no")
    For i = 1 To m '~~~> for 1 to that number
      For x = 1 To 10 '~~~> print the multiplcation table of that number (1 to 10)
        s = x * i
        Print x & " x " & i & " = " & s
      Next
      Print
    Next
    End Sub

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Some Explanation with printing table in a one row

    Kindly find the attachment and let me know the idea.Why it gets invisible after Some Time.Kindly let me know the idea.Any help would be highly appreciated.
    Code:
    Private Sub Form_Activate()
    Dim x As Integer, m As Integer, s As Integer, c As Integer
    m = InputBox("Enter a no")
    For c = i To m
     For x = 1 To 10
      s = x * c
      Print s;
      Next
      Print
      Next
    End Sub
    Last edited by firoz.raj; May 30th, 2011 at 02:09 PM.

  10. #10
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Some Explanation with printing table in a one row

    You are using this code in the Form_Activate event. That means, each time you click on other window and click back to the original window, the code will be executed.

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Some Explanation with printing table in a one row

    Even i write in a double click event it gets invisible after a some Seconds.Kindly let me know the idea.Any help would be highly appreciated.
    Code:
    Private Sub Form_DblClick()
    Dim x As Integer, n As Integer, s As Integer, c As Integer
    m = InputBox("Enter a no")
    For n = 1 To m
     For x = 1 To 10
      s = x * n
      Print s;
      Next
      Print
      Next
    End Sub

  12. #12
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Some Explanation with printing table in a one row

    But, I didn't find any invisibility here....
    Are you using anything more than the Demo Project(the above attachment) contains...??? (ie. any other codes or events...???)

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  13. #13

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Some Explanation with printing table in a one row

    when form shows table of numbers.kindly see some seconds after some seconds .it gets invisible automatically.

  14. #14
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Some Explanation with printing table in a one row

    Try setting the AutoRedraw property of Form to True

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  15. #15

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Some Explanation with printing table in a one row

    can anyone demonstrate i simple want user should enter any name using input box .like Salal Ahmed Abdullah.it should print S.A Abdullah.
    John k Fernandes.it should print J.k. Fernandes.can you tell me .how should i print on the form this way Using Left/right or Mid or instr() Function.Kindly let me know the idea.i want to know about String Function.
    Last edited by firoz.raj; Feb 9th, 2010 at 12:58 AM.

  16. #16
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Some Explanation with printing table in a one row

    Quote Originally Posted by firoz.raj View Post
    i want to know about String Function.
    Check this link: http://www.vb6.us/tutorials/vb6-string-functions

    Quote Originally Posted by firoz.raj View Post
    can anyone demonstrate i simple want user should enter any name using input box .like Salal Ahmed Abdullah.it should print S.A Abdullah.
    John k Fernandes.it should print J.k. Fernandes.can you tell me .how should i print on the form this way Using Left/right or Mid or instr() Function.Kindly let me know the idea.i want to know about String Function.
    A sample code...
    Code:
    Dim strFullName As String, Temp() As String, strNewName As String '~~~> Variable declarations
    strFullName = "John k Fernandes"  '~~~> Sample name. Here, you can use User inputted name also.
    Temp = Split(strFullName, " ")  '~~~> Splitting the three words
    strNewName = Mid(Temp(0), 1, 1) & ". " & Mid(Temp(1), 1, 1) & ". " & Temp(2)  '~~~> Selecting the first character of each word and then the third word.
    MsgBox strNewName '~~~> Display the modified name

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  17. #17

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Some Explanation with printing table in a one row

    can you clarify the split Function.additional why did you take temp() string type array.instead of String type variable.
    [code=vb]
    Temp = Split(strFullName, " ") '~~~> Splitting the three words
    [/code]

  18. #18
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Some Explanation with printing table in a one row

    Quote Originally Posted by firoz.raj View Post
    can you clarify the split Function.additional why did you take temp() string type array.instead of String type variable.
    [code=vb]
    Temp = Split(strFullName, " ") '~~~> Splitting the three words
    [/code]
    Tutorial : http://www.vb6.us/tutorials/vb-strin...it-join-filter ....

    You can follow other methods too....

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  19. #19

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Some Explanation with printing table in a one row

    ok Split() Function work on the basis of delimeter.and it makes array on the basis of delimeter of any given string.But one last question can you demonstrate using instr Function.since i always get in trouble when i handle
    any these type of function.Kindly demostrate using instr() fuction.

  20. #20
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Some Explanation with printing table in a one row

    You can try other methods also....
    Code:
    Dim strFullName As String, strNewName As String '~~~> Variable declarations
    Dim intSpace1 As Integer, intSpace2 As Integer
    
    strFullName = "John k Fernandes"  '~~~> Sample name. Here, you can use User inputted name also.
    strFullName = Trim$(strFullName) '~~~> Remove any unwanted spaces from beg and end of the string
    intSpace1 = InStr(1, strFullName, " ")
    intSpace2 = InStr(intSpace1 + 1, strFullName, " ")
    strNewName = Mid(strFullName, 1, 1) & ". " & Mid(strFullName, intSpace1 + 1, 1) & ". " & Mid(strFullName, intSpace2 + 1)
    MsgBox strNewName '~~~> Display the modified name

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  21. #21

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Some Explanation with printing table in a one row

    can you explain a specific line.additional what is the main difference between
    Mid and instr Fucntion.
    Code:
    intSpace1 = InStr(1, strFullName, " ")

  22. #22
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Some Explanation with printing table in a one row

    I think the links that I had given to you will explain it in detail....

    Difference(my definition):
    instr() will return the position of a particular character in a string.
    mid() will allow you to extract only the required sub string.

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  23. #23

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Some Explanation with printing table in a one row

    Some more in inbuild function.can you tell me what will return the following function.Kindly let me know the idea.Any help would be highly appreciated.
    Code:
    IIf(btHandleRead.Tag = "ADD", "yes", "no")

  24. #24
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Some Explanation with printing table in a one row

    if the Tag is ADD, then it will return yes. Otherwise, no...

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  25. #25

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Printing Issue

    Can anyone tell me ??? . Why the Following Error is Not Coming in Message Box ???.here are the following Code What I have writtem .the error message needs to be come in MessageBox on Runtime .
    Code:
    Public Sub btprint_Click()
    On Error GoTo errhnd
    Me.PrintForm
    errhnd:
    MsgBox Err.Description
    End Sub
    Last edited by firoz.raj; May 30th, 2011 at 02:08 PM.

  26. #26
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: Some Explanation with printing table in a one row

    I'm not sure about that issue. But when I tried the following code and pressed the Command1 button and suddenly clicked the Cancel button (of the Save window), it showed a "Printer Error" message in a MessageBox.
    vb Code:
    1. Private Sub Command1_Click()
    2.     On Error GoTo errhnd
    3.    
    4.     Me.PrintForm
    5.    
    6.     Exit Sub
    7. errhnd:
    8.     MsgBox Err.Description
    9. End Sub
    Note the use of Exit Sub. You have to include that line before the label for error (errhnd). Otherwise, each time of click the button, that MsgBox will also be displayed regardless of whether there's error or not.


    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

  27. #27

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2009
    Location
    Watch Window(Shift+f9)
    Posts
    1,879

    Question Re: Some Explanation with printing table in a one row

    The Problem is Simple When I Do Step In(F8) .when it Comes on Me.PrintForm . when I again Press F8 .It even Does Not Go To Next Line . and giving Error No 482 . How should I Trap this Printer Error Message ??? .if it Even does not go to next line when I press F8.Let me know the Idea .Any help would be highly appreciated.
    Still I am Getting The Same Error !!! .
    Code:
    Private Sub Btprint_Click()
    On Error GoTo errHnd
    Me.PrintForm
    Exit Sub
    errHnd:
    MsgBox Err.Description
    End Sub
    Last edited by firoz.raj; Dec 27th, 2010 at 12:17 AM.

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