944,030 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 2077
  • VB.NET RSS
Jul 24th, 2006
0

A few little problems

Expand Post »
I have purchased Visual Studio .Net 2003 and i like it, it's quite easy yo use, but i have a few problems i cannot solve.
Im assume that some of the problems are solved somewhere in here, but i am in an internet cafe, i dont have an internet connection home so i dont have the time to search through the forum... :-s

1: If i make a button to CLOSE the application i just have to type "END" into the [private sub button_click... / end sub], but what if i want to make a button to minimize the window ? (I hope it's just a short word, like "END").
I tried Me.Close (that works like END) and Me.Hide... but "hide" really hides the window and i must stop debugging and restart the application to maximize it again. :p I'm sure it's very simple.

2: How can i make one form move if i drag it, wherever i would click on it? I mean, i can move a window only if i grab the bar (the thing with minimize, maximize and close buttons). But HOW can i move the window by clicking and draging anywhere on it ?
I tried something with Ctrl+arrows to move the window and it works:
VB.NET Syntax (Toggle Plain Text)
  1. If e.KeyValue = Keys.Left Then Me.Left = Left - 25
  2. If e.KeyValue = Keys.Up Then Me.Top = Top - 25
But how can i do something similar with the mouse? I tried to make Private Sub Form1_DragDrop and the only thing it had to do was to MsgBox("You drag-dropped the form"), but whatever i do, i dont see the msgbox, so i'm doing something wrong.

3: How can i launch one .mp3, or .avi, or .doc from my application ? I dont want to make a video player or a MS Word clone. I just want the file to open with media player (for mp3), or word (for doc).
I really need the most efficient way, to open the files very fast.

4: I've learned one method to read XML files... but how can i WRITE some data into a XML file ? Lets suppose i have:
VB.NET Syntax (Toggle Plain Text)
  1. <grandma>
  2. <mother>
  3. <daughter> She has a little toy. </daughter>
  4. </mother>
  5. </grandma>
(Lol, this is the first example that popped up in my mind.) I want to read "She has a little toy." and write "She has a BEAR." instead.
Any method would do, since i don't know too many... My only method of reading is this:
VB.NET Syntax (Toggle Plain Text)
  1. Dim ShownTEXT as String
  2. Dim Doc As New XmlDocument
  3. Dim Nav As XPath.XPathNavigator
  4. Dim Iterator As XPath.XPathNodeIterator
  5.  
  6. Doc.Load("..\Data.xml")
  7. Nav = CType(Doc, XPath.IXPathNavigable).CreateNavigator()
  8. Iterator = Nav.Select("grandma/mother/daughter")
  9. Iterator.MoveNext()
  10. shownTEXT = Iterator.Current.Value
  11. MsgBox(shownTEXT)
There is also another type of XML i would like to read, but i have no idea HOW !:
VB.NET Syntax (Toggle Plain Text)
  1. <root>
  2. <example name="horse">
  3. <this_animal_eats>grass</this_animal_eats>
  4. </example>
  5. <example name="wolf">
  6. <this_animal_eats>meat</this_animal_eats>
  7. </example>
  8. </root>
How can i read what example named "Wolf" eats, instead of reading what "Horse" eats ? Then, how can i write anything else instead of "grass" and "meat" ?

Please help. Thank you very much.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Prahaai is offline Offline
59 posts
since May 2005
Jul 24th, 2006
0

Re: A few little problems

1.         Me.WindowState = FormWindowState.Minimized

2.	  
VB.NET Syntax (Toggle Plain Text)
  1. 'This is not my code. It is
  2. 'It is copyrighted by Andrew Vos 2004 :)
  3. 'to whom I am gratefull.
  4. Private Sub PlaceHolder_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
  5. MouseDragging(e, Me)
  6. End Sub
  7.  
  8. Public Sub MouseDragging(ByVal e As MouseEventArgs, ByVal Control As Control)
  9. Static OldPosition As New Point(-1, -1)
  10. If Not (e.Button = Nothing) Then
  11. If e.Button = Windows.Forms.MouseButtons.Left Then
  12. If (OldPosition.X = -1) And (OldPosition.Y = -1) Then OldPosition = New Point(e.X, e.Y)
  13. If e.Y <> OldPosition.Y Then
  14. Control.Top += e.Y - OldPosition.Y
  15. End If
  16. If e.X <> OldPosition.X Then
  17. Control.Left += e.X - OldPosition.X
  18. End If
  19. End If
  20. Else
  21. 'button is nothing, maybe it was lifted.
  22. OldPosition = New Point(-1, -1)
  23. End If
  24. End Sub
  25.  
  26. Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
  27. MouseDragging(e, Me)
  28. End Sub
3. Dim strParms As String = "c:\Test.txt" System.Diagnostics.Process.Start(strParms) 4. Don't know someone can probably help

Wayne
Reputation Points: 84
Solved Threads: 58
Posting Pro in Training
waynespangler is offline Offline
461 posts
since Dec 2002
Jul 27th, 2006
0

Re: A few little problems

Thank you very much for all the help, everything is going great.
As for the last problem i had, i am using NINI. (nini.sourceforge.net)

Thanx again.
Everything is solved.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Prahaai is offline Offline
59 posts
since May 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Re: Basic Sorted Neighborhood in VB
Next Thread in VB.NET Forum Timeline: Open program when selecting default file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC