A few little problems

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2005
Posts: 57
Reputation: Prahaai is an unknown quantity at this point 
Solved Threads: 0
Prahaai's Avatar
Prahaai Prahaai is offline Offline
Junior Poster in Training

A few little problems

 
0
  #1
Jul 24th, 2006
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:
  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:
  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:
  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 !:
  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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2002
Posts: 461
Reputation: waynespangler is on a distinguished road 
Solved Threads: 56
waynespangler waynespangler is offline Offline
Posting Pro in Training

Re: A few little problems

 
0
  #2
Jul 24th, 2006
1.         Me.WindowState = FormWindowState.Minimized

2.	  
  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
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 57
Reputation: Prahaai is an unknown quantity at this point 
Solved Threads: 0
Prahaai's Avatar
Prahaai Prahaai is offline Offline
Junior Poster in Training

Re: A few little problems

 
0
  #3
Jul 27th, 2006
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC