Results 1 to 26 of 26

Thread: simple how to get a commondialoge to print an image to am picture box

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    simple how to get a commondialog to print an image to a picture box a txt file is easy but what about a .gif or .ico file.

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Use LoadPicture function

    Picture1.picture=Loadpicture(Commondialog1.Filename)
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    no problem

    Code:
    Set Picture1.Picture = LoadPicture(commondialog1.FileName)

  4. #4
    Guest
    Just incase you're interesed, you can save the Picture again by using the SavePicture method.
    Code:
    SavePicture Picture1.Picture, "C:\MyPicture.bmp"

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    Originally posted by Megatron
    Just incase you're interesed, you can save the Picture again by using the SavePicture method.
    Code:
    SavePicture Picture1.Picture, "C:\MyPicture.bmp"
    Thank you Thank you Thank you. Yes i needed that.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    Originally posted by adam3000
    Originally posted by Megatron
    Just incase you're interesed, you can save the Picture again by using the SavePicture method.
    Code:
    SavePicture Picture1.Picture, "C:\MyPicture.bmp"
    Thank you Thank you Thank you. Yes i needed that.
    Any ideas on how to do the same thing with text
    save it to a spot on a file of some kind?

  7. #7
    Guest
    To save a Text File
    Code:
    Open "C:\MyFile.txt" For Output As #1
    Print #1, Text1
    Close #1
    To load a Text File
    Code:
    Open "C:\MyFile.txt" For Input As #1
    Text1 = Input(LOF(1), 1)
    Close #1

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    Originally posted by Megatron
    To save a Text File
    Code:
    Open "C:\MyFile.txt" For Output As #1
    Print #1, Text1
    Close #1
    To load a Text File
    Code:
    Open "C:\MyFile.txt" For Input As #1
    Text1 = Input(LOF(1), 1)
    Close #1
    Is there a way to save the text from a specific text box into a specific spot on an html or asp page?

  9. #9
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Yep, you could open in binary
    Code:
    Open Filehtml for binary as #1
     Buffer=space(lof(1)-yourposition+1)
     Get #1,yourposition,Buffer
     Put #1,yourposition,Text1
     Put #1,Buffer
    close 1
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    Originally posted by kedaman
    Yep, you could open in binary
    Code:
    Open Filehtml for binary as #1
     Buffer=space(lof(1)-yourposition+1)
     Get #1,yourposition,Buffer
     Put #1,yourposition,Text1
     Put #1,Buffer
    close 1
    How does this work. how is the position specified in the html or asp page?

  11. #11
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    What it does is open your file, filename specified in filehtml string. Buffers the rest of the file that starts from yourposition, puts the text in textbox text1 at yourposition and then put the rest of the buffer after the text. (Exactly as you wanted it to do?)

    hmm, replace
    Put #1,Buffer
    with
    Put #1,,Buffer

    YOu specify the position in bytes, the location in the file
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    Originally posted by kedaman
    What it does is open your file, filename specified in filehtml string. Buffers the rest of the file that starts from yourposition, puts the text in textbox text1 at yourposition and then put the rest of the buffer after the text. (Exactly as you wanted it to do?)

    hmm, replace
    Put #1,Buffer
    with
    Put #1,,Buffer

    YOu specify the position in bytes, the location in the file
    Thank you, Ill give it a try.

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    Originally posted by adam3000
    Originally posted by kedaman
    What it does is open your file, filename specified in filehtml string. Buffers the rest of the file that starts from yourposition, puts the text in textbox text1 at yourposition and then put the rest of the buffer after the text. (Exactly as you wanted it to do?)

    hmm, replace
    Put #1,Buffer
    with
    Put #1,,Buffer

    YOu specify the position in bytes, the location in the file
    Thank you, Ill give it a try.
    Anyone got any idea how to read a possition on an html page in bytes?????????????????///////

  14. #14
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Anyone got any idea how to read a possition on an html page in bytes?
    I thought that was what you had to specify, in your html page, do you have any particular text on which you can use for a reference point?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  15. #15

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    Originally posted by kedaman
    Anyone got any idea how to read a possition on an html page in bytes?
    I thought that was what you had to specify, in your html page, do you have any particular text on which you can use for a reference point?
    Ok lets say i use a particular text on which to use as a reference point how would you write that?

  16. #16
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well, assuming you just have one Reference point:
    Code:
    Open Filehtml for binary as #1
     Buffer=space(lof(1))
     Get #1,,Buffer
     Parts=Split(Buffer,RefText)
     Put #1,len(Part(0))+1,RefText & Text1 & Part(1)
     For N=2 to ubound(Parts)
      Put #1,,Parts(N)
     Next N
    close 1
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  17. #17

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    Originally posted by kedaman
    Well, assuming you just have one Reference point:
    Code:
    Open Filehtml for binary as #1
     Buffer=space(lof(1))
     Get #1,,Buffer
     Parts=Split(Buffer,RefText)
     Put #1,len(Part(0))+1,RefText & Text1 & Part(1)
     For N=2 to ubound(Parts)
      Put #1,,Parts(N)
     Next N
    close 1
    Open "H:\wwwroot\softwaretest2.asp" For Binary As #1
    Buffer = Space(LOF(1))
    Get #1, , Buffer
    Parts = Split(Buffer, thistext)
    Put #1, Len(Part(0)) + 1, thistext & txtName1.Text & Part(1)
    For N = 2 To UBound(Parts)
    Put #1, , Parts(N)
    Next N
    Close 1
    Like that?

  18. #18
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    yep, if you have the correct variables, have you tested it?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  19. #19

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    Originally posted by kedaman
    yep, if you have the correct variables, have you tested it?
    So I have to Dim Buffer, Parts, thistext(As String) and Part
    It says method or data member not found for txtName1.text but that does exist on that form. Thats wiered its telling me my only options for that are Count, Item, LBound, and UBound. Ill try Item. But it still sayes argument not optional. hmmmm.

  20. #20

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    Originally posted by adam3000
    Originally posted by kedaman
    yep, if you have the correct variables, have you tested it?
    So I have to Dim Buffer, Parts, thistext(As String) and Part
    It says method or data member not found for txtName1.text but that does exist on that form. Thats wiered its telling me my only options for that are Count, Item, LBound, and UBound. Ill try Item. But it still sayes argument not optional. hmmmm.
    hmm interesting that ubound pops up as an expected aray

  21. #21

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    Originally posted by adam3000
    Originally posted by adam3000
    Originally posted by kedaman
    yep, if you have the correct variables, have you tested it?
    So I have to Dim Buffer, Parts, thistext(As String) and Part
    It says method or data member not found for txtName1.text but that does exist on that form. Thats wiered its telling me my only options for that are Count, Item, LBound, and UBound. Ill try Item. But it still sayes argument not optional. hmmmm.
    hmm interesting that ubound pops up as an expected aray
    Can i use just one item in a multidimentional array like this???

  22. #22
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    You could press reply instead of quote when you reply something that's if you don't want to have those quotes there.

    Parts should be a variant containing the array. Thistext can be for instance a textbox or just a string,
    Code:
    Dim Parts, Buffer as string,n as integer
    
    Open "H:\wwwroot\softwaretest2.asp" For Binary As #1 
        Buffer = Space(LOF(1)) 
        Get #1, , Buffer 
        Parts = Split(Buffer, thistext) 
        Put #1, Len(Parts(0)) + 1, thistext & txtName1.Text & Parts(1) 
        For N = 2 To UBound(Parts) 
            Put #1, , Parts(N) 
        Next N 
    Close 1
    Ubound works with multidimensional arrays too, you just specify the dimension index in the second argument.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  23. #23

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    hehe hi
    got this http://www.xitinc.com/softwaretest2.asp
    guess i messed up somewhere i only get boxes instead of text this is the code i used:
    Dim Parts, Buffer As String, n As Integer

    Open "H:\wwwroot\softwaretest2.asp" For Binary As #1
    Buffer = Space(LOF(1))
    Get #1, , Buffer
    Parts = Split(Buffer, "thistext")
    Put #1, Len(Parts(0)) + 1, "thistext" & txtName1.Count & Parts(1)
    For n = 2 To UBound(Parts)
    Put #1, , Parts(n)
    Next n
    Close 1

  24. #24

    Thread Starter
    Junior Member
    Join Date
    Jul 2000
    Posts
    18
    i used txtName1.Count instead of txtName1.text because the it sayes method or data memeber not found.

  25. #25
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    .count? So you have a control array? No you should put the string you wanted at the spot on your html:
    Any ideas on how to do the same thing with text
    save it to a spot on a file of some kind?
    Or is it the count of controls you want to have there?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  26. #26
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    you could just store the position you got earlier, + the keyfrase and then write again as you want to update
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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