Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Damage variable

Damage variable

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestion
10 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mr kilany
    wrote on last edited by
    #1

    i send a vairable to another application but some time the variable damage and add some thing diffrent ... i dont know why ... for example : dim s as string ="4294:DN" windows.minimaiz send.sendwait("s")/ print in active window windows.maximize the problem the first time print the s as 4294:DN on the another window but aftet repeat the action of print the variable will print some thing deffirent like 44294:::DN why the variable change ?????????? kilany

    D 1 Reply Last reply
    0
    • M Mr kilany

      i send a vairable to another application but some time the variable damage and add some thing diffrent ... i dont know why ... for example : dim s as string ="4294:DN" windows.minimaiz send.sendwait("s")/ print in active window windows.maximize the problem the first time print the s as 4294:DN on the another window but aftet repeat the action of print the variable will print some thing deffirent like 44294:::DN why the variable change ?????????? kilany

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Mr kilany wrote:

      i send a vairable to another application

      How are you doing this? There's only about a dozen different ways... Dave Kreskowiak Microsoft MVP - Visual Basic

      M 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Mr kilany wrote:

        i send a vairable to another application

        How are you doing this? There's only about a dozen different ways... Dave Kreskowiak Microsoft MVP - Visual Basic

        M Offline
        M Offline
        Mr kilany
        wrote on last edited by
        #3

        i send variable by this fuction dim ss as string = textbox1.text // here imagen i put "2415666:" /// here code whcih minimaze the form of vb.net System.Windows.Forms.SendKeys.SendWait("ss")// here the code which different and change . and after many click of button which make this action the string will print as "245566654" or some thing wrong .. the question why the variable printed like this .... ///here code whcih minimaze the form of vb.net kilany

        D 1 Reply Last reply
        0
        • M Mr kilany

          i send variable by this fuction dim ss as string = textbox1.text // here imagen i put "2415666:" /// here code whcih minimaze the form of vb.net System.Windows.Forms.SendKeys.SendWait("ss")// here the code which different and change . and after many click of button which make this action the string will print as "245566654" or some thing wrong .. the question why the variable printed like this .... ///here code whcih minimaze the form of vb.net kilany

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Copy and paste the ACTUAL code, don't retype it here. What your saying is happening is impossible from the code that you've posted. Dave Kreskowiak Microsoft MVP - Visual Basic

          M 1 Reply Last reply
          0
          • D Dave Kreskowiak

            Copy and paste the ACTUAL code, don't retype it here. What your saying is happening is impossible from the code that you've posted. Dave Kreskowiak Microsoft MVP - Visual Basic

            M Offline
            M Offline
            Mr kilany
            wrote on last edited by
            #5

            Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Try Dim cone As New Conection Dim ii As Integer = ds.Tables(0).Rows(ComboBox1.SelectedIndex).Item(0) Dim sh As String = cone.get_Special_data("select Switch_Access_Code from Swiches where Swich_ID=" & ii & "") b2 = "" b2 = sh Me.WindowState = FormWindowState.Minimized System.Windows.Forms.SendKeys.SendWait(b2)//b2="2494:" come from //database on sql server Me.WindowState = FormWindowState.Normal b2 = "" Catch ex As Exception MsgBox("الرجاء اختيار القسم") End Try End Sub some times when i click on this button will type on active window 4294: but aslo some time type 44294: and some time 4294:: and some time 4294: and some time 4449942: althought the data which comes from data base is just 4294: why the variable b2 some time print wrong data not as want ??????? kilany

            D 1 Reply Last reply
            0
            • M Mr kilany

              Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Try Dim cone As New Conection Dim ii As Integer = ds.Tables(0).Rows(ComboBox1.SelectedIndex).Item(0) Dim sh As String = cone.get_Special_data("select Switch_Access_Code from Swiches where Swich_ID=" & ii & "") b2 = "" b2 = sh Me.WindowState = FormWindowState.Minimized System.Windows.Forms.SendKeys.SendWait(b2)//b2="2494:" come from //database on sql server Me.WindowState = FormWindowState.Normal b2 = "" Catch ex As Exception MsgBox("الرجاء اختيار القسم") End Try End Sub some times when i click on this button will type on active window 4294: but aslo some time type 44294: and some time 4294:: and some time 4294: and some time 4449942: althought the data which comes from data base is just 4294: why the variable b2 some time print wrong data not as want ??????? kilany

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Don't make me repeat myself.... The problem is not the variable, but the method in which your code is TYPING it into the other application. I just got done telling you that you've chosen, possibly, the worst method to pass data to another application. SendKeys is NOT guaranteed to put the data into that TextBox exactly as sent. This is because SendKeys cannot control how the keystrokes you're sending are processed by the other app. Dave Kreskowiak Microsoft MVP - Visual Basic

              M 1 Reply Last reply
              0
              • D Dave Kreskowiak

                Don't make me repeat myself.... The problem is not the variable, but the method in which your code is TYPING it into the other application. I just got done telling you that you've chosen, possibly, the worst method to pass data to another application. SendKeys is NOT guaranteed to put the data into that TextBox exactly as sent. This is because SendKeys cannot control how the keystrokes you're sending are processed by the other app. Dave Kreskowiak Microsoft MVP - Visual Basic

                M Offline
                M Offline
                Mr kilany
                wrote on last edited by
                #7

                Dear. sorry ... but can you give me a best method which pass data to another application ... really i need to use it ...and the way to use it ? kilany

                D 1 Reply Last reply
                0
                • M Mr kilany

                  Dear. sorry ... but can you give me a best method which pass data to another application ... really i need to use it ...and the way to use it ? kilany

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #8

                  The best method is if the other application exposes a COM object model to use. Other that that, the possibilities get very complicated. If you're putting text into a TextBox, then you could find a way to get the window handle of the target window and use WM_SETTEXT to fill in the TextBox. Google for "WM_SETTEXT FindWindow" and you'll come up with some examples. Dave Kreskowiak Microsoft MVP - Visual Basic

                  M 1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    The best method is if the other application exposes a COM object model to use. Other that that, the possibilities get very complicated. If you're putting text into a TextBox, then you could find a way to get the window handle of the target window and use WM_SETTEXT to fill in the TextBox. Google for "WM_SETTEXT FindWindow" and you'll come up with some examples. Dave Kreskowiak Microsoft MVP - Visual Basic

                    M Offline
                    M Offline
                    Mr kilany
                    wrote on last edited by
                    #9

                    i dont need to write in note pade and the another application read from it. i need to use the sendwait() method but the problem what happed ? really i dont know maybe i shoudl add timer to the button action to slow down the transfer of data from vb.net to another application ..so i need the solution .. because i work with seminar project and i have a 1/5 as a dead date .. the problem is transfer a data from vb.net to another application without any changes of data.. please i send more than 12 to get the answer but still at this moment without a correct soluation...please help me. kilany

                    D 1 Reply Last reply
                    0
                    • M Mr kilany

                      i dont need to write in note pade and the another application read from it. i need to use the sendwait() method but the problem what happed ? really i dont know maybe i shoudl add timer to the button action to slow down the transfer of data from vb.net to another application ..so i need the solution .. because i work with seminar project and i have a 1/5 as a dead date .. the problem is transfer a data from vb.net to another application without any changes of data.. please i send more than 12 to get the answer but still at this moment without a correct soluation...please help me. kilany

                      D Offline
                      D Offline
                      Dave Kreskowiak
                      wrote on last edited by
                      #10

                      No matter what, SendKeys cannot control how the destination application processes the keys sent to it. You can slow it down using a Timer, but I seriously doubt that it'll do you any good. If you really want to use SendKeys, you'll have to pay VERY close attention to how you other application behaves and how each control behaves when it gets the focus from your app. Then you'll have to modify the key string you send to account for being in the wrong control or to make sure the focus is in the correct control and the insertion point is in the correct position before you send any data. Even then, you can't guarantee accurate results. This is because ANY keystroke or mouse click anywhere on the screen during the SendKeys command, or before the target app processes the keystrokes can seriously screw up what you sent. The bottom line is there is NO RELIABLE METHOD TO DO THIS!! Dave Kreskowiak Microsoft MVP - Visual Basic

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups