|
Hi everyone i need to create a match fixture in vb.net i need to write a code that enable two teams compete against each other in a match game. can someone tell me how to do this please
thanks
|
|
|
|
|
Define what you mean by "fixture" and what a "match" consists of.
|
|
|
|
|
He defined all that to you the LAST time he asked you to do his homework for him.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Yep, and it still wasn't enough to get him to think about the solutions to each little problem.
|
|
|
|
|
Look here. You have been asking this question for days. You will still be asking it when this project is due, and you will fail. And, you deserve it. We do NOT do homework for people not even willing to make a start for themselves. If we did, it would not help you, because you'd have learned NOTHING and you would therefore be stuck on the next assignment, which would assume you knew how to do the first one. Either read your resources, talk to your teacher, or drop out of your course and get a job at McDonalds.
We're happy to help people who are trying and are stuck. We don't help people to get through courses without learning anything, because odds are, we may well end up stuck with them on our teams.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hello to All,
I have two buttons button1 and button2.
in button1_Click
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
On Error GoTo err
Groupbox3.visible = False
GroupBox1.Visible = True
cmb_barcodefont.Focus()
Exit Sub
err:
MsgBox(Err.Description, MsgBoxStyle.Information, Err.Number)
End Sub
and
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Groupbox1.visible = False
GroupBox3.Visible = True
Dim intimage As Integer
Dim barlist As LinearBarCode.Barcode = Barcode1
ReDim imageArray(ListbarcodeValue.Items.Count)
If ListbarcodeValue.Items.Count > 0 Then
For intimage = 0 To ListbarcodeValue.Items.Count - 1
barlist.DataToEncode = ListbarcodeValue.Items.Item(intimage)
Dim img As System.Drawing.Image = barlist.IndependentEMF
imageArray(intimage) = img
Next
Else
Image = barlist.IndependentEMF
End If
barlist = Nothing
Updowncolumn.Focus()
End Sub
at this time the error is occor
System.ArgumentException was unhandled
Message="Parameter is not valid."
Source="System.Drawing"
StackTrace:
at System.Drawing.Image.get_FrameDimensionsList()
at System.Drawing.ImageAnimator.CanAnimate(Image image)
at System.Drawing.ImageAnimator.ImageInfo..ctor(Image image)
at System.Drawing.ImageAnimator.Animate(Image image, EventHandler onFrameChangedHandler)
at System.Windows.Forms.PictureBox.Animate(Boolean animate)
at System.Windows.Forms.PictureBox.Animate()
at System.Windows.Forms.PictureBox.OnPaint(PaintEventArgs pe)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.MessageBox(HandleRef hWnd, String text, String caption, Int32 type)
at System.Windows.Forms.MessageBox.ShowCore(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, Boolean showHelp)
at System.Windows.Forms.MessageBox.Show(IWin32Window owner, String text, String caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
at Microsoft.VisualBasic.Interaction.MsgBox(Object Prompt, MsgBoxStyle Buttons, Object Title)
at Barcode_Software.Form1.Button1_Click(Object sender, EventArgs e) in E:\Barcode_Software\Barcode Software\Form1.vb:line 173
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Barcode_Software.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
If you can think then I Can.
|
|
|
|
|
Looks like your code has an error, AND you're passing invalid params to the message box. Have you considered using breakpoints to debug your code ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Yes sir,
It's build successfully but first i click on button1 and then i click on button2 it's works normally.
but when i again come back it's generate this error.
i was send full details of error.
Thanks for consideration.
If you can think then I Can.
|
|
|
|
|
Well, don't email me anything. Just use the debugger to find the actual error and the actual line where it happens, and then tell us.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
First, you're using VB.NET, so scrap the On Error Goto garbage from VB6.
Next, you haven't said on which line the error occurs. You're also using some barcode library that you don't say where it came from. Nor do you say what you're trying to do with this code.
|
|
|
|
|
is it my code problem or Dll problem ?
If you can think then I Can.
|
|
|
|
|
It could be either. If your not using the library correctly, the probably is obviously going to be your code. If there's a bug in the library, who knows.
|
|
|
|
|
But Error is Generated in this line
GroupBox1.Visible = True
In this line what parameter is incorrect.
If you can think then I Can.
|
|
|
|
|
What controls do you have in the GroupBox? It would appear that one of them has a problem.
|
|
|
|
|
Yes Picturebox and Panel in Groupbox.
If you can think then I Can.
|
|
|
|
|
And what are you showing in the PictureBox and what's going on with the Panel?
|
|
|
|
|
I've posted this up on the MSDN in the VB section and it has sat there receiving 55 views and still no answers or suggestions. I'm hoping that maybe someone here can help me understand it and help me find a solution. Now, I've gone and I've bought at least 300 dollars worth of books and tried every example I could find on the internet and tried to learn on my own, but I've hit a snag that requires some expertise. I do not claim to be a great VB programmer, but I'm hoping that my skill will increase with time. It took a friend of mine 5 years to master C programming, and after he mastered it, it only took him 3 months to master C++ and C#. So, I have hope that I'll master VB faster than he mastered C.
I have read - recently - many topics concerning the connection of TCP/IP connecting versus using the old winsck connecting method. Currently, I'm in the middle of a project and I'm completely lost as to which direction to go because I've tried both directions (winsck & TCP/IP) without any sort of avail. Currently, I am attempting to create my own mud client (as a reference, you could look at Nerdy Mud Client @ SourceForge - I'm trying to recreate the VB6 project using VB 2008 EE). Thus far, I've been able to appropriately get my forms together and working the way I wanted them. I've got the main form, with a window where the text output should be, I've got a text input bar and set it to AcceptsReturn True so people can type a message into the bar and hit enter to submit it, but for some reason, I can't get it to connect at all. I'd like it to actually connect to "legendsofkrynn.wolfpaw.net:6100." I keep finding tutorials on creating P2P chat clients and FTP clients, but that's not what I want. I want my client to talk to the server and receive information from the server, as well as send user input commands to the server. Currently, this is the code that I've got for my connection method.
'Connects to legendsofkrynn.wolfpaw.net:6100
Private Sub ConnectToolStripMenuItem_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles ConnectToolStripMenuItem.Click
winsock1.Connect("legendsofkrynn.wolfpaw.net", 6100)
End Sub
Unfortunately, if this connects, it won't display the output into my mudViewer form (which is just a regular textbox set to multiline = true). Unfortunately as well, if this doesn't connect, I have no way to figure it out. Now, I've also tried....
Import System
Import System.Net.Sockets
At the top of the code is where I put that part, and then I used the same code for my winsock1 connect as before, and still nothing. Then I figured out that you probably shouldn't use the winsck controller with the Imports. So, I used the Imports again and then attempted this code.
'Connects to legendsofkrynn.wolfpaw.net:6100
Private Sub ConnectToolStripMenuItem_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles ConnectToolStripMenuItem.Click
myTCPClient.Connect("legendsofkrynn.wolfpaw.net", 6100)
End Sub
And, unfortunately, it still did not work. Now. I'm very well aware that I'm still an incredibly large nooblet when it comes to VB and this is actually a rather large project for someone of Beginner skill to take on, but I'd really like to figure this out and get it working. Is there anyone that could offer me some good advice? Most of the tutorials I have found are only for P2P chat clients, and FTP transfer clients - as previously stated. Can anyone please, please please help me understand it? Now, my project is INCREDIBLY BASIC at this point in time. Here's the full code for the primary form.
Public Class mudclient
'Closes the entire client because the client MDI = true.
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles ExitToolStripMenuItem.Click
Me.Close()
End Sub
'Shows the current system clock time.
Private Sub btnMenuTimer_Tick(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles btnMenuTimer.Tick
btnMenuClock.Text = TimeOfDay
End Sub
'Opens the options dialogue.
Private Sub OptionsToolStripMenuItem_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles OptionsToolStripMenuItem.Click
options.ShowDialog()
End Sub
'Shows the Event Calendar for Scheduled or Notated Events.
Private Sub btnEvent_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles btnEvent.Click
eventScheduler.Show()
End Sub
'Connects to legendsofkrynn.wolfpaw.net:6100
Private Sub ConnectToolStripMenuItem_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles ConnectToolStripMenuItem.Click
winsock1.Connect("legendsofkrynn.wolfpaw.net", 6100)
End Sub
'Disconnects from legendsofkrynn.wolfpaw.net:6100
Private Sub DisconnectToolStripMenuItem_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles DisconnectToolStripMenuItem.Click
End Sub
End Class
Can anyone please help me?
|
|
|
|
|
Having no actual experience myself, with what you are trying to do, here is a couple of thoughts that may help:
- Attempt the actual connection in a Try Catch block with msgbox(ex.tostring) to first find out if it really is not connecting, or if there is simply some error in the code.
- Does the .Connect method in your winsock code example return a value? If so, the return value may tell you why the connection fails / is refused. You can step through the code, or perhaps you can show the return value (if there is one) in a messagebox as well.
- Almost all remote connections require some sort of identification (username / password). Have you checked if maybe the connection simply wants you to supply such information?
My advice is free, and you may get what you paid for.
|
|
|
|
|
Johan made some good suggestions in the other post, but more can't hurt...
You posted the connection code, which may or may not be working, but where's the code that does the actual I/O? The code that sends the user-entered text, and the code that displays the incoming data? If that code has errors, it would explain why you aren't seeing any output.
Socket programming can be a little complicated for beginners, mainly because you generally use a second thread to watch for output, and you have to parse out individual messages from the network stream.
|
|
|
|
|
You're showing the code for the form , but you're not showing ANY of the TCP handling code at all. If all you have is a call to Connect, and nothing else, then it's not surprising you're not seeing anything come back. You don't have any code handing any of the received data and putting in in the textbox.
|
|
|
|
|
Everyone,
Thank you so much for your suggestions! Johan, I actually did not think of that. I don't have any block for winsck that would show whether or not the connection was connected or not. Ian and Dave, I did not think of having code to handle the I/O. The basic concept is that I want this one client to connect to the remove server (legendsofkrynn.wolfpaw.net) on the specified port (6100). So it would make sense that there would need to be something that needed to handle the I/O. Would you recommend I use a module or a class for the I/O handling? Also, which would actually be more prudent to use in my current quest? Winsck or TCP/IP? Many people say that with the development of VB 2008, there's no longer a need to use winsck, would anyone agree?
|
|
|
|
|
The general rule is that when you're programming a .NET language, try to stay within the .NET framework and .NET-based libraries (aka "Managed code") unless you really need to do otherwise. Hence, don't use winsock directly. Use a TcpClient. The winsock DLLs are pretty much obsolete anyway, I believe.
I do suggest, though, that if this is your first foray into programming, you pick a simpler project. Network clients aren't incredibly complicated, but they pull in several concepts that are a little above the beginner level.
Here's the brief summary of what you need to do:
1) Get the network stream from the GetStream() function. This is an abstraction of the "pipe" you use to read and write data from the network.
2) To simplify access to this stream, create a System.IO.StreamReader. This does all the work of buffering the incoming data, splitting it into discrete messages, and letting you read one line at a time.
3) Create a background thread to watch the streamreader and read the incoming data. Look up System.Threading.ThreadPool.QueueUserWorkItem for a "safe" way to do it. If you're not familiar with the concept, having an extra thread is basically like running two parts of the program at the same time (Sort of). The background thread will keep watching the network for incoming data.
4) Have the background thread loop on the streamreader's ReadLine() function, to get the actual data.
5) When it gets a line, Invoke to the GUI thread (This is needed, because background threads can't touch GUI controls) and add the line to your text box.
Those five steps will let you see the data coming in from the network... Sending data is actually a lot easier...
1) Create a StreamWriter on the same stream in the first step above.
2) When the user presses enter in the input box, grab the text from that box and use the StreamWriter's WriteLine() method, followed by Flush() (Flush makes sure the data actually gets sent, instead of waiting in a buffer).
3) Also add that text to the output window, since MUD clients expect you to echo the data you send.
I've bolded some of the keywords, so you know what to look up in your references... But like I said, this is a bit above beginner level, so take your time and keep google handy.
|
|
|
|
|
Ian,
This is some really great advice! Thanks so much for writing it for me. So far, I'm shocked and surprised that I get more help here than I do on the MSDN official VB forums with Microsoft, heh. I'm definitely checking into these things as of right this moment. Now, I do have a question, do you think it would be more beneficial for me to modulate the your suggestions, or should I privatize them and make them classes? Also, I'm including code below - upgraded I/O module - from Nerdy Mud Clients source code. Should I attempt to just copy/paste and credit that portion of the code to Nerdy, or are your suggestions above suggestions for I/O? I know that sounds like a stupid question and I apologize if it makes me look even more noobish. I know this project is definitely above my level, but I'm fully committed to seeing it through. To me, I feel that it's better to tackle something difficult and learn as much from it as possible than to keep with the smaller projects and learn little by little. Backwards logic, I know.
Option Strict Off
Option Explicit On
Module mdlDataIO
Dim cmdhistRow As Short
Dim cmdhistNewPos As Short
Dim cmdHistTmp As String
Public arraycmdhist(30) As String
Public Sub multisend(ByRef txt2send As String)
frmMain.Winsock1.SendData(txt2send & vbCr)
End Sub
Public Sub File2Combo(ByRef sfile As String, _
ByRef oList As System.Windows.Forms.ComboBox) _
'this has been relocated from frmmain to help modularize and clean up code
'it should be stable and complete
Dim fnum As Short
Dim sTemp As String
fnum = FreeFile()
oList.Items.Clear()
FileOpen(fnum, sfile, OpenMode.Input)
While Not EOF(fnum)
sTemp = LineInput(fnum)
oList.Items.Add(sTemp)
End While
FileClose(fnum)
End Sub
Public Sub cmdHistScrollup() 'stable/finalized
If CDbl(frmMain.lblSBH.Text) = 30 Then frmMain.lblSBH.Text = CStr(0)
If arraycmdhist(CInt(frmMain.lblSBH.Text)) = "" Then
Do While arraycmdhist(CInt(frmMain.lblSBH.Text)) = "" _
And CDbl(frmMain.lblSBH.Text) < 30
frmMain.lblSBH.Text = CStr(CDbl(frmMain.lblSBH.Text) + 1)
Loop
End If
frmMain.txtInput.Text = arraycmdhist(CInt(frmMain.lblSBH.Text))
If CDbl(frmMain.lblSBH.Text) <= 29 Then frmMain.lblSBH.Text = _
CStr(CDbl(frmMain.lblSBH.Text) + 1)
End Sub
Public Sub cmdhistscrollDown()
If CDbl(frmMain.lblSBH.Text) = 0 Then frmMain.lblSBH.Text = CStr(30)
If arraycmdhist(CInt(frmMain.lblSBH.Text)) = "" Then
Do While arraycmdhist(CInt(frmMain.lblSBH.Text)) = "" _
And CDbl(frmMain.lblSBH.Text) > 0
frmMain.lblSBH.Text = CStr(CDbl(frmMain.lblSBH.Text) - 1)
Loop
End If
frmMain.txtInput.Text = arraycmdhist(CInt(frmMain.lblSBH.Text))
If CDbl(frmMain.lblSBH.Text) >= 1 Then frmMain.lblSBH.Text = _
CStr(CDbl(frmMain.lblSBH.Text) - 1)
End Sub
End Module
|
|
|
|
|
Ok, one thing at a time...
1) Forget modules. That's a VB6 thing. The closest parallel is a "static class", which for something like this, you don't need.
2) The code you posted is something else entirely... You don't need that at all.
Basically, here's the interface I would suggest (Not spoon-feeding the code - Just setting up a layout):
Public Class ServerConnection
Public Property IsConnected as Boolean
Get
Private Set
End Property
Public Sub Connect(ByVal address as String, ByVal port as Long)
End Sub
Public Sub Disconnect(ByVal address as String, ByVal port as Long)
End Sub
Public Sub SendMessage(ByVal message as String)
End Sub
Public Event MessageReceived(ByVal sender as Object, ByVal message as String)
End Class
This is just the interface... It's up to you to implement it. The idea is that only this class actually knows how the data is going back and forth, so everything not shown here is set as Private. The rest of your application can just send and receive messages simply, without having to know the details. The term for this is "encapsulation", and it's one of the staples of object-oriented programming.
Granted, you could put all of the code in the same file as your form, but if you start out with a good design structure, it makes it easier to add to it later, and much easier to read.
As for putting the results in a textbox... Well, that part is a lot simpler.
|
|
|
|
|
hi expert
my question is reletant to listview control. i want to move listview control in runtime.
ex. suppose same data in listview and i want to move listview control because back of listview conrol same item define.
|
|
|
|
|