|
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[^].
|
|
|
|
|
Dave Kreskowiak wrote: HereGoogle it[^].
Fixed that for you.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Michelle Shoniwa wrote: using vb6.0
VB6 has been dead and unsupported by Microsoft since March of 2005, you might want to reconsider doing any real work in VB6.
"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
|
|
|
|
|
Good day everybody,
I have placed a Timer (System.Threading.Timer) in my app that fires every 1 sec. Every now and then, it just stops runinng. The app does not report any errors, and therefore I have no idea what so ever. Here is the code:
//Assing timer's callback sub
Private Sub FrmMain_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
'*Grade Engine
Dim GradeTmrDel As New Threading.TimerCallback(AddressOf GradeTmr_Routine)
GradeTmr = New Threading.Timer(GradeTmrDel, Nothing, 2000, 1000)
End Sub
//this is the callback sub
Private Sub GradeTmr_Routine(ByVal iState As Object)
Static InProcess As Boolean
Dim Msg(), SubMsg(1), NextGrade As String
If InProcess Then Return
InProcess = True
Try
NextGrade = Get_NextGrade()
......
End If
Catch ex As InvalidOperationException
Handle_Er(Err, "GradeTmr") : End
Catch
Handle_Er(Err, "GradeTmr")
Finally
InProcess = False : Grading = False
End Try
End Sub
//Error handler routine - writes to eventlog and posts a message on screen
Private Sub Handle_Er(ByRef Er As ErrObject, ByRef Source As String)
If StatBar.Panels(1).Text = "" Then
StatBar.Panels(0).Text = "Warning! at least one error has been logged!" : StatBar.Panels(1).Icon = New System.Drawing.Icon("W95MBX03.ICO") : StatBar.Panels(1).Text = "Clear"
StatBar.Panels(0).ToolTipText = "Use the Event Viewer to access error's data" : StatBar.Panels(1).ToolTipText = "Click to reset!"
End If
syscorelog.WriteEntry(Er.Description & Chr(10) & Source & Chr(10) & Er.GetException.StackTrace, EventLogEntryType.Error)
End Sub
Thanks for your guidance!
Alex.
|
|
|
|
|
You might want to try stopping the timer at the beginning of the tick handler and starting it again at the end. Comment out the code that keeps track of InProcess.
|
|
|
|
|
Hi Dave,
That is the first approach a tried, but timers within the system.threading namespace
do not have the STOP, START methods of timers within the system.timer namespace.
I then tried using the CHANGE method of this timer to replicate the same behavior, but the app did not like that at all. Apparently what it did was to generate new threads of the timer thus consuming all CPU resources.
I chose the system.threading namespace timer, because I understood this class automatically run the timer in the system provided thread.
The app has two other timers that fire each at different intervals and I have noticed that some times two or all three of them present the same issue.
Hope this helps you to help me
Thanks for your time.
Alex.
|
|
|
|
|
alexvw wrote: That is the first approach a tried, but timers within the system.threading namespace
do not have the STOP, START methods of timers within the system.timer namespace.
Whoops. You're right. So, then destroy the timer and create a new one.
|
|
|
|
|
Hi Dave,
I will try that approach!
thanks.
Alex.
|
|
|
|
|
i m making paint and brush in vb.net, the problem is when i draw any graphic (eg.- line rectanle, e.t.c), on my picture box, the graphic get unsaved on the image, as soon as i do another action i.e- click anwhere else on pic box, minimization of working window...
then drawing done get erased...
now i want u to help me in saving the previously done drawing on the pic box "image"
i m a bigginer, please help me!!!
With regards
Vineet Swami
Isol
Vineet Swami
Isol
|
|
|
|
|
This problem tells me that your not managing drawing properly. All drawing has to be done in your OnPaint event. You can get away with drawing from outside the OnPaint event, but only temporarily. Once Windows tells the control to redraw itself, you'll lose all the painting you've done outside of OnPaint.
What you have to do is once you get done "drawing" with the mouse, all the changes you just made have to be drawn on a bitmap object so that you have the changes saved and they can be redrawn at any time by the code in the OnPaint event.
|
|
|
|
|
here is not any OnPaint event, i have paint event and that not work properly this is coading of this event
Private Sub PicBox_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PicBox.Paint
If brect = 1 Or bellipse = 1 Or bline = 1 Then
x2 = Cursor.Position.X
y2 = Cursor.Position.Y
x = Me.Location.X + 9
y = Me.Location.Y + 57
x2 = x2 - x
y2 = y2 - y
bm = PicBox.Image
Dim tpen As New Pen(frmmain.lblcolfront.BackColor)
If bline = 1 Then
objgraphics.DrawLine(tpen, x1, y1, x2, y2)
End If
If x1 < x2 Then
If y1 < y2 Then
If brect = 1 Then
objgraphics.DrawRectangle(tpen, x1, y1, x2 - x1, y2 - y1)
End If
If bellipse = 1 Then
objgraphics.DrawEllipse(tpen, x1, y1, x2 - x1, y2 - y1)
End If
Else
If brect = 1 Then
objgraphics.DrawRectangle(tpen, x1, y1 - (y1 - y2), x2 - x1, y1 - y2)
End If
If bellipse = 1 Then
objgraphics.DrawEllipse(tpen, x1, y1 - (y1 - y2), x2 - x1, y1 - y2)
End If
End If
Else
If y1 < y2 Then
If brect = 1 Then
objgraphics.DrawRectangle(tpen, x1 - (x1 - x2), y1, x1 - x2, y2 - y1)
End If
If bellipse = 1 Then
objgraphics.DrawEllipse(tpen, x1 - (x1 - x2), y1, x1 - x2, y2 - y1)
End If
Else
If brect = 1 Then
objgraphics.DrawRectangle(tpen, x1 - (x1 - x2), y1 - (y1 - y2), x1 - x2, y1 - y2)
End If
If bellipse = 1 Then
objgraphics.DrawEllipse(tpen, x1 - (x1 - x2), y1 - (y1 - y2), x1 - x2, y1 - y2)
End If
End If
End If
End If
bm.Save("C:\Documents and Settings\manojji\My Documents\My Pictures\temp" & ".bmp")
End Sub
Vineet Swami
Isol
|
|
|
|
|
First, objGraphics isn't defined anywhere in the code you've posted. Next, what is bm and where is it defined??
|
|
|
|
|
objGraphics is defined in a module publicly as
Public objgraphics As Graphics = Frmpage.PicBox.CreateGraphics()
bm is a bitmap object defined as
Dim bm As Bitmap
Private Sub Frmpage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
bm = PicBox.Image
End Sub
thanks
Vineet Swami
Isol
|
|
|
|
|
This is a bad idea. You should be creating a Graphics object whenever you need it, then use it, and Dispose of it. Don't create one and hang onto it for the life of your application.
Also, setting the bitmap object equal to the PictureBox.Image isn't really buying you anything. The bitmap object should be it's own bitmap, drawn on when the mouse is released, then the PicBox, when not drawing on mouse down, should be drawing the contents of this bitmap.
|
|
|
|
|