|
As the others have said, do your own homework!
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Vinke2008 wrote: ID Model Colour Horepower
Yeah, I really like it when a car has a lot of horepower...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
dancing girls, yeah dancing girls.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hai!!!
Here I am doing a object oriented program.In that we create various classes in class library.And, we add reference of the dll to the project.My doubt is I have created a new class class Maze.Which will create a maze shape in UserInterface.The content of the maze class is read from a text in the path specified.And, i have created maze using inheriting the cube class.With select the maze file content is read and if it is 'X' it creates cube and it is '0' it end the if statement.And, the File is reading correctly Character by charater.And, Finally I am getting an Exception thrown by Target of an invocation.The code I wriiten are,
Private Sub Maze()
'READING CHARACTER BY CHARACTER
'============================================
Dim intSingleChar As Integer
Dim charSingleChar As String
Dim OpenFL As FileStream = New FileStream("C:\Users\admin\Desktop\MinMini.vb\MinMini.vb\bin\Debug\Botlets\Maze.txt", FileMode.Open, FileAccess.Read, FileShare.None)
Dim ReadFL As StreamReader = New StreamReader(OpenFL)
ReadFL.Read()
CharNo = 0
While ReadFL.Peek <> -1
Do Until CharNo = OpenFL.Length
intSingleChar = ReadFL.Read
charSingleChar = Chr(intSingleChar)
Select Case CharNo
Case 0 To 16
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 17 To 32
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 33 To 48
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 49 To 64
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 55 To 80
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 81 To 96
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 97 To 112
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 113 To 128
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 129 To 144
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 145 To 160
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 161 To 176
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 177 To 192
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 193 To 208
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 209 To 224
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 225 To 240
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 241 To 256
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 257 To 272
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
Case 273 To 286
If charSingleChar = "X" Then
bt = New Templates.Botlet.MyCube()
bt.Y = bt.CHeight / 2
bt.Frame.Location = New Point3d(bt.CWidth * i, 0, 0)
Me.SubBotlets.Add(bt)
i = i + 1
End If
End Select
CharNo = CharNo + 1
Loop
MsgBox("Peek" & CharNo)
End While
End Sub
Please give me some suggesions to clear the exception.
|
|
|
|
|
You never said what the exception was, so it's kind of hard to pin anything down.
But, glancing through the code, it would appear that you're reading one character past the end of the file. In your Do loop, check for the EndOfFile, not the character count you've read against the length of the file.
|
|
|
|
|
I have a main form with a contextmenustrip. I have the contextmenustrip being displayed immediately when the form is loaded. The problem is that the contextmenu is being displayed about a half second before the form is visible. I've tried launching the menu from load, activate, focus, enter, etc. Also tried using suspendlayout. Same result.
Any ideas on how to sync the menu to be displayed when the form is done loading and already visible?
|
|
|
|
|
Hello,
I will give you suggestion.See wheater it works...The Contextmenustrip must be visible by MyMouseDown Event only.so, put an If statement in MymouseDown, that has the code this:
If e.Button = Windows.Forms.MouseButtons.Right Then
ContextMenuStrip1.Show()
End If
so, i think your contextmenustrip will be visible only when you click the right button of the mouse.
|
|
|
|
|
try the form 'Shown' event
|
|
|
|
|
I had high hopes about this since I missed this method last night, but the result is the same. The menu is displaying about half a second prior to the form being loaded.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
modified on Tuesday, October 14, 2008 8:57 PM
|
|
|
|
|
well if all else fails you could use a timer to display the menu a second after the shown event has been triggerd (start the timer in the shown event)
but I'm shure this isn't the best solution, at the moment I can't think of an other way
|
|
|
|
|
I am currently working on a app that loads a TAB delimeted text file
into a listbox then runs through the listbox and breaks each line into
four different listboxes. The file loads fine, but when I try to break
the string appart and add them to different listboxes I get an error.
Here is the code I'm using that is returning the error:
For theList = 0 To lstMain.Items.Count - 1
theListText = lstMain.Items(theList)
Dim Break() As String = theListText.Split(" ")
lstSymbol.Items.Add(Break(0))
lstScience.Items.Add(Break(1))
lstCommon.Items.Add(Break(2))
Next
The error message I get says: 'Index was outside the bounds of the array.'
Does anyone know how I would fix this? Any help would be appreciated.
Jeff
|
|
|
|
|
Dunno. If you still have the initial string var of where your reading the line in, you could split that.
<br />
Example (freehand):<br />
strLine = sr.ReadLine<br />
dim Break() as string = split(strLine, vbtab)<br />
<br />
lstSymbol.Items.add(Break(0))<br />
lstScience.Items.add(Break(1))<br />
lstCommon.Items.add(Break(2))<br />
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
Test the length of Break() when adding it to the other listbox, I would guess that there is a missing column in the array.
As kissdznuts said you should be working with the original file instead of the listbox.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I tried the way kissdznuts explained but it only split the first line of the file into their respective listboxes. Also, how do I test the length
of Break()?
Jeff
|
|
|
|
|
Ensure the file is truly tab delimited. When you do the split(strLine, vbtab), you should have sep. elements for each column.
Length test:
break(1).length >= 12 'enter whatever number you're expecting by column.
Hope that helps.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
I don't know what I'm doing wrong.
I tried doing the length test word for word and I get:
1) Expression expected
2) Method arguments must be enclosed in parentheses
For the life of me I just can't get this code to work.
I can't really find anything on the internet about splitting a delimited
file into 'multiple' listboxes. I tried it with the file being TAB
delimeted and comma delimeted and nothing seems to work.
I hate to ask for someone to write the code for me, I don't think I
would learn as much that way. Thanks for everyone's help by the way.
Any more suggestions?
This is my FULL code:
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Dim stream_reader As New IO.StreamReader("C:\plants.txt")
lstMain.Items.AddRange(Split(stream_reader.ReadToEnd, _
vbCrLf))
lstMain.SelectedIndex = 0
stream_reader.Close()
Catch exc As Exception
' Report all errors.
MsgBox(exc.Message, MsgBoxStyle.Exclamation, "Read " & _
"Error")
End Try
Dim i As Integer
For i = 0 To lstMain.Items.Count - 1
Dim strLine As String = lstMain.Items(i)
Dim Break() As String = Split(strLine, ",")
lstSymbol.Items.Add(Break(0))
lstScience.Items.Add(Break(1))
lstCommon.Items.Add(Break(2))
Next
End Sub
Jeff
|
|
|
|
|
I Have a transparent rtb via:
Public Declare Function SetWindow Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Integer, ByVal Index As Integer, ByVal NewVal As Integer) As Integer
Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_TRANSPARENT = &H20
and, at form_load:
Dim result As Integer = SetWindow(rtb.Handle.ToInt32,GWL_EXSTYLE, WS_EX_TRANSPARENT)
Works fine. The issue I can't seem to figure out is how to display one character over another.
Sample code:
Dim Sym_Font As New Font=
("Symbols",16,font_style.Regular,GraphicsUnit.Pixel)
' "O" is a solid circle
' "F" some symbol to display on top of the circle
rtb.SelectionFont() = Sym_Font
rtb.SelectionColor() = Color.LightGray
' Circle
Dim cp As Integer = rtb.SelectionStart 'get position
rtb.AppendText("O") 'draw the filled circle
rtb.Select(cp, 1) 'back up position
'the overlay
rtb.SelectionColor() = Color.Green
rtb.SelectedText() = "F"
Sym_Font.Dispose()
The "F" displays but the circle is gone. Getting rid of the rtb.select(cp,1) statement will show the circle followed by the symbol.
|
|
|
|
|
Using an unmodified RichTextBox, this isn't supported. AFAIK, you'd have to create your own RichTextBox control, inheriting from the existing one, and supply your own drawing code to do this.
|
|
|
|
|
Thanks. I guess their idea of "rich text" is a little different than mine.
|
|
|
|
|
Hello,
How we can compare two datasets/datatables(without loop) to find out the mismatch of records? I just want find the records which is not in datasetA and which in datasetB?
Thanking you in advance...
Sebastian T Xavier
|
|
|
|
|
AFAIK, you cannot compare two datasets directly.
However, if you load (or merge) the datatable from datasetA to datasetB, you can build a foreign key constraint (or constraints) between the two tables. With that you get an exception if rows don't match.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
yeah, thats a good point... thanks
Sebastian
|
|
|
|
|
You're welcome.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
How are you. Please help me on connecting to access using vb6.0 and to also save the data into access using vb6.0?
|
|
|
|
|
Your question has been answered, thousands of times, over the last 10 years. All it takes is a little searching to find the answers. Here[^].
|
|
|
|
|