|
Help with what?? You haven't asked a specific question about the part you're having a problem with.
|
|
|
|
|
If this is paid work, tell the client you are a fraud. If it's homework, talk to your teacher, if you're too lost to ask specific questions, the teacher is the one best able to help.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hello,
In the project I am currently working on I need to create a few listboxes dynamicly. This, so far, is no problem:
The declaration:
Public newlistbox() As ListBox
ReDim Preserve newlistbox(chatnummer)
newlistbox(chatnummer) = New ListBox
Me.Controls.Add(newlistbox(chatnummer))
Me.newlistbox(chatnummer).Location = New Point(100, 150)
Me.newlistbox(chatnummer).Size = New Size(105, newrichbox(chatnummer).Height)
newlistbox(chatnummer).Name = newchannel
This part works fine, but now I want to perform an action when the listbox has been double clicked.
Normally you would use something like
.... Handles newlistbox.DoubleClick
But this gives an error.
I have seen a post using withevents as declaration but this doesnt work for me since i am using an array listbox.
Any ideas on how i can do this?
I am working with vb.net 2008
modified on Sunday, April 26, 2009 6:09 AM
|
|
|
|
|
Hi,
have a look at the AddHandler statement.
|
|
|
|
|
|
|
Can someone point me to good info for adding the ability to a RichtextBox to wrap text around an image (like in Word and Works)? I've read that the RTB doesn't support the entire RTF specification, but I'm thinking one should be able to alter the RTF code in the background to get it done. I'd rather not reinvent the wheel if someone already has some code (VB.net) posted. Failing that, any good advice on getting it done is appreciated.
|
|
|
|
|
Iam very very new to vb.net and am learning a lot through examples from code project. I want to define a user control (mybutton)
Question:
I defined an enum property for the user defined control (inherits button). The proeprty is shape of the button (round, rectangular, elliptical etc). During design time when I change the shape property from say rectangular to elliptical, the shape of the button doesn't gets updated in the form. Any help on how to achieve this?
Thanks,
GJ
|
|
|
|
|
You would normally redraw the control by handling the Paint event. If you're painting code is elsewhere, you're going to have problems.
|
|
|
|
|
Hi,
I'm a novice at writing code, especially VB, however, I need some help writing VB code or something similar. I'm open to suggestions. I need to have the program either .vbs or .bat or what is recommended look in C:\Documents and Settings or C:\Program Files\IBM or C:\Program Files\Lotus for a file called "ctman.nsf" without the quotes. If it finds that file it needs to notify the user it has found that file and the location and of course with an OK button. If it doesn't find that file it needs to notify the user that the file was not found with an OK button. I plan on emailing this out to my users via Lotus notes (they are all on the same network and its Internal and having them run this file to search) and from Lotus they will just save it to their desktop, or if it's small enough in code size I might have them run it from our server.
If you have any questions feel free to ask. I'll be on the board all day until I can get some help. Thank you.
cjc
|
|
|
|
|
|
Can I just put that code in a vbs document and run it?
-cjc
|
|
|
|
|
Sure, if you want to fail at it. Try understanding how the methods work first, then write code more appropriate for your own app.
|
|
|
|
|
Actually I just made a quick batch file and that worked perfect...about three lines of code and it does what I need it too. Thanks.
cjc
|
|
|
|
|
I'm writing a solitaire game and want a specific card in a control array, let's say image1(12) which has a specific picture associated with it, to drop onto a specific position and take over the image of another control array, hearts(12). Here is my code; keep getting file not found. Just using one element in the array right now for testing.
Any help would be much appreciated. I'm a noob LOL.
Private Sub Hearts_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
Hearts(12).Picture = Image1(12).Picture
Index = 0
For Index = 0 To 51
If TypeOf Source Is Image Then
Hearts(12).Picture = Source.Picture
LoadPicture Image1(12).Picture
'Load Hearts(Index).Picture.ubound + 1
Else: MsgBox ("Your chosen card does not belong here")
End If
Next
End Sub
Private Sub Clubs_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
Index = 0
For Index = 0 To 51
If TypeOf Source Is Image Then
Clubs(Index).Picture = Source.Picture
End If
Next
End Sub
Private Sub Diamonds_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
Index = 0
For Index = 0 To 51
If TypeOf Source Is Image Then
Diamonds(Index).Picture = Source.Picture
End If
Next
End Sub
Private Sub Spades_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
Index = 0
For Index = 0 To 51
If TypeOf Source Is Image Then
Spades(Index).Picture = Source.Picture
End If
Next
End Sub
Private Sub Image1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
For Index = 0 To 51
If Button = vbLeftButton Then
Image1(Index).Drag vbBeginDrag
End If
Next
End Sub
Private Sub Image1_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
For Index = 0 To 51
If Button = vbLeftButton Then
If Image1(Index).Picture = Hearts(Index).Picture Then
Image1(Index).Drag vbEndDrag
Else: GoTo 5
5 If Image1(Index).Picture = Clubs(Index).Picture Then
Image1(Index).Drag vbEndDrag
Else: GoTo 9
9 If Image1(Index).Picture = Diamonds(Index).Picture Then
Image1(Index).Drag vbEndDrag
Else: GoTo 12
12 If Image1(Index).Picture = Spades(Index).Picture Then
Image1(Index).Drag vbEndDrag
Else: MsgBox ("This card does not match the source card")
Image1(Index).Picture = Image1(Index).Picture
End If
End If
End If
End If
End If
Next
End Sub
|
|
|
|
|
Wow - your code is everything that's bad about VB. Why are you using VB6 for new code ? It's obsolete and unsupported. VB.NET express edition is free, and there's far more help for it. Why are you using VB6, do you hate yourself ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
LOL, ROFL. That's the only thing I have as far as the program that offers VB 6.0; if Net is free, I can go to that, but I'd have to learn a new language quick; I might be able to swing this; where do you get this, MS site? If so, do you have any idea on what I'm trying to do and can help me in .NET coding? I'd have to change all my code and am happy to post what I have so far, but need to know how to change to .NET. I have until June; in which the game I'm writing is for my Mom's birthday. Any help would be much appreciated. Does .NET have gui too like Visual Basic for MS? IF so, I'd like to use it; if not, then not now, not for this game. I like the visual aspect of it.
|
|
|
|
|
ymilan wrote: where do you get this, MS site?
Yes, just google VB.NET Express Edition.
ymilan wrote: oes .NET have gui too like Visual Basic for MS?
No, .NET has a language and an IDE that leaves VB6 for dead.
VB.NET is going to be far easier, and you will get a LOT more help, because people actually use it.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Thanks; I'm trying in Net now and learning; however, I copied some code and am trying it out. I have image1 as the array name of images of cards shuffled on the left. Hearts, Clubs, etc. are the arrays on the right. I'm getting lots of errors. Any help or tutorial pages locations would be great. Trying to shuffle cards right now. Much appreciation in advance.
Friend Class Start_Game
Inherits System.Windows.Forms.Form
Dim Index As Integer
Dim value As Integer
Dim suit As String
Dim picturefront As String
Dim position As Integer
Dim shuffled As Boolean
Private Sub Start_Click() Handles Start.Click
Dim count, x As Integer
'sets the actual image1 in suit order used at the start form load
For x = 51 To 0 Step -1
_Image1(x).Index = x - -1
Image1(x).suit = "image1"
If (x - -1) < 10 Then
Image1(x).value = (x - -1)
End If
If (x - -1) > 10 Then
Image1(x).value = 10
End If
Next
'Hearts'
For x = 52 To 40 Step -1
Hearts(x).Index = (x - 39)
Hearts(x).suit = "Hearts"
If (x - 39) < 10 Then
Hearts(x).value = (x - 39)
End If
If (x - 39) > 10 Then
Hearts(x).value = 10
End If
Next x
Exit For
'Clubs
For x = 39 To 27 Step -1
Clubs(x).Index = (x - 26)
Clubs(x).suit = "Clubs"
If (x - 26) < 10 Then
Clubs(x).value = (x - 26)
End If
If (x - 26) > 10 Then
Clubs(x).value = (10)
End If
Next x
'Diamonds
For x = 26 To 14 Step -1
Diamonds(x).Index = (x - 13)
Diamonds(x).suit = "Diamonds"
If (x - 13) < 10 Then
Diamonds(x).value = (x - 13)
End If
If (x - 13) > 10 Then
Diamonds(x).value = (10)
End If
Next x
'Spades
For x = 13 To 1 Step -1
If x < 10 Then
Spades(x).value = x
End If
If x > 10 Then
Spades(x).value = 10
End If
Spades(x).Index = x
Spades(x).suit = "Spades"
Next x
For count = 1 To 52
Image1(count).shuffled = False
Next count
'set back of cards
For x = 1 To 52
Image1(x).pictureback = path & "C:\Project1\backing.gif"
Next x
End Sub
End Sub
End Class
|
|
|
|
|
ymilan wrote: _Image1(x).Index = x - -1
This looks like you're going to end up with x + 1, x - -1 is x + 1.
The best way to shuffle the cards is to get a list from 1 to 52 ( or whatever ). Then create a new list, and put stuff in at random.
Assuming that arrays are 0 indexed in VB.NET ( your code seemed to assume they are 1 indexed and I do not know for sure ), you grab a number between 1 and 52 and you remove the number at that index and put it in your new list. Then you grab a number between 1 and 51 ( because you only have 51 left to shuffle, right ?) and grab the number at that index and push it into your new list. Go all the way down, and you will have a shuffled deck.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Thanks much for your assistance; I've decided to obviously go with NET and am currently reading tutorials before I start this again....I'll probably be back...LOL.
|
|
|
|
|
Hi,
I try to fade images in and out with a timer but i didn't find an simple piece of code for an alphablending funktion...
Does someone know a solution?
|
|
|
|
|
[VB Helper.com]
What a surpise, I googled "vb.net fade image". Wasnt really that hard.
If everything was not true, would it be not true that everything is not true?
|
|
|
|
|
Sorry, you are right
but i used Ixquick not google 
|
|
|
|
|
Hi
I have a form and what I would like to do is to detect when a user clicks on a mouse button and holds it down to measure the amount of time they have held down the mouse button. If after a certain amount of time to reset the mouse click to false.
My objective is to prevent users undertaking drag and drop. On my form users can see word documents (the document is displayed in ms word inside my application), and I would like to stop them from selecting a piece of text and then dragging the selection from this document on to another. Therefore, I was wondering if I could measure the amount time a mouse button has been held down and reset the action to false or to mouse up to stop it.
Does anyone know whether this possible or have any other suggestions that would be better?
|
|
|
|