|
And if the scanner fails, what can the user do then? The keyboard is a good back-up solution for such cases.
|
|
|
|
|
I was actually going to create a button to activate manual input.
I will look in to your solution, but later...
First i need to get everything working, so we can start using the scanner. I'll fine-tune later.
Thanks for your help!
Greetz
|
|
|
|
|
Hi all. Im having a problem with losing data in a class but im unsure as to exactly how its happening. I post here an example of the parts of the code i am using that are causing a problem with an explanation of where i am seeing the problem(s) and hopefully someone will be able to point out what i am doing wrong.
line 1 public ndlist as list (of data)
line 2 public dylist as list (of days)
line 3
line 4
line 5 public sub main_routine()
line 6
line 7 ndlist = new list (of data)
line 8 dylist = new list (of days)
line 9
line 10 for a = 1 to something
line 11 do
line 12
line 13 ndlist.add(new data("blahblah"))
line 14
line 15
line 16 loop until something
line 17
line 18 dylist.add(new days(a,b,ndlist))
line 19 ndlist.clear
line 20
line 21 next a
line 22
line 23 for each dy as days in dylist
line 24
line 25 next
line 26
line 27 end sub
line 28
line 29
line 30
line 31
line 32
line 33 public class days
line 34
line 35 public day_data as list(of data)
line 36
line 37 public sub new(byval a as integer, byval b as integer,byval ddata as list(of data))
line 38
line 39 day_data = ddata
line 40
line 41 end sub
line 42
line 43 end class
line 44
line 45 public class data
line 46
line 47 public rwdata(1500)
line 48 public id as string
line 49
line 50 public sub new(byval str as string)
line 51
line 52 id = str
line 53
line 54 end sub
line 55
line 56 end class
So you can see basically i have a list of days containing a list of data for each day. I use the data class in lists elsewhere in the project and thought it would be easier to re-use it for the day class. What i am seeing is between lines 10 and 21 the program operates normally. If i insert a breakpoint in vs2010 on line 18 i can watch the dylist add items to its collection and when i drill down the elements of the collections i can see the data where i expect it to be. For reference the data is at
dylist.item(x).day_data.item(y).rwdata(z)
The problem comes when i exit the for/next loop for further processing. When i get to line 23 and i access
dy.item(x).day_data.item(y).rwdata(z)
it contains nothing as do all the the other elements in the dylist collection and i have no idea why?
The code runs all at once and there is no background threads or anything else happening in the background when i run the code. I am firing it off a button just now for testing.
Any ideas?
btw - great website! i use this all the time for little snippets of info for my coding but have never had to resort to posting here yet. Thanks for all the help ive utilised from your site so far
modified 12-Mar-13 9:09am.
|
|
|
|
|
What do you reckon might be happening here with ndlist ?
line 18 dylist.add(new days(a,b,ndlist))
line 19 ndlist.clear
Try this:
dylist = new list (of days)
for a = 1 to something
ndlist = new list (of data)
do
ndlist.add(new data("blahblah"))
' do something to ndlist
loop until something
dylist.add(new days(a,b,ndlist))
next a
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
modified 12-Mar-13 9:09am.
|
|
|
|
|
I figured it out just now. Seems im actually passing the reference of ndlist to the class contructor so (as you pointed out) when i clear the list i also clear all of the data in all of the instances of the dylist class members. Very confusing
What i actually want to do is initialise the list type for the instance of the class within its contructor and then recursivley add the list members to each class instance separately. Using a "work" list and passing it as a parameter doesnt work
My thinking was that a list would be passed the same way as the values in an array are passed, so you could modify the source list afterwards without affecting your previous destination lists.
Im going to blame monday for this one...
|
|
|
|
|
I looking into doing the following....
Create CSV files via VB.Net and then add these files to 7 zip manager. I want to do this automatically rather than getting the users to manually add these files to 7 zip manager. Before I start doing this....
1. Can this be done
2. If so how and is there any good examples I could use?
Thanks in advance.
|
|
|
|
|
|
Thanks for getting back and providing me with the information. As below, this should be enough for me to work something out.
|
|
|
|
|
|
Thanks for getting back and providing me with the information. This should be enough for me to work something out.
|
|
|
|
|
I want a simple program using "File Mapping" for communication betrween two processes.............the commncation can be either using dialouge or console communications ............Thank you please help me out its urgent.Am writing code in VB 6.0
|
|
|
|
|
This forum will not supply you with a fully functioning solution.
You must make an attempt to solve your problem, then post a question where you are stuck.
This sounds like a homework assignment, so you need to make an effort towards a solution.
Start building your program, then come back with specific questions.
|
|
|
|
|
- Your subject is non-descriptive, not helpful at all.
- It's not urgent, we're volunteers.
- VB6 is deprecated, it's dead. No new software is written in it, it's no longer sold, it's not supported.
- We don't supply programs/complete source code. It's a forum for developers, doing development.
FWIW; there's a FileSystemWatcher in .NET that easy to use, and VB.NET is free to download and use. If one app is launched from the other, I'd suggest using stdio, reading and writing to the console-window. If they're on separate computers, look into WCF.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I have four textboxes. Each one is filled by selecting a date from the monthcalendar (VS win form). While I handled most of the problems, such as a dbnull, I discovered this little "oops". I use the same type of handle for each daterangeevetargs:
Private Sub MonthCalendarPO_DateSelected(sender As Object, e As DateRangeEventArgs) Handles MonthCalendarPO.DateSelected
JobPOdateTextBox.Text = e.Start.ToShortDateString
MonthCalendarPO.Visible = False
End Sub
A click of a picture box to hide and show the calendar:
Private Sub PictureBoxPO_Click(sender As Object, e As EventArgs) Handles PictureBoxPO.Click
If MonthCalendarPO.Visible = False Then
MonthCalendarPO.Visible = True
Else
MonthCalendarPO.Visible = False
End If
End Sub
I removed the custom validation too. So, I will not post. The problem exists even without checking the date format.
Each date is filled and visible in a textbox. Yet, when clicking the "save" button, only one date will remain in a textbox and save on submit changes (dates are bound to a bindingsource). As I have read and and read some more, I feel it must be the daterangeeventargs.
Worth noting, if you manually enter the date into the textboxes, all four dates will save on submit changes. For now, I have resolved to a submit changes to the database after each date selection. This is certainly not ideal or a good practice.
Bindingsource is filled as system.linq.iqueryable(of namespace.tablename). Data class is Linq2SQL.
Any ideas on why this type of behavior is experienced?
|
|
|
|
|
The handler is overwriting the data in the textbox when it is called. Change it to a concatenation;
Private Sub MonthCalendarPO_DateSelected(sender As Object, e As DateRangeEventArgs) Handles MonthCalendarPO.DateSelected
JobPOdateTextBox.Text += e.Start.ToShortDateString
MonthCalendarPO.Visible = False
End Sub
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks again. What would I do without your brain. I was not even looking at the string development in any manner. I should have known that. My languages are a little mixed up some days. Dumb newbie thing ... LOL
|
|
|
|
|
In VB6.0 Do you know the name of the control cell grid in the image above there are two lines in the header and the grid can color, see attached image. we can see in the figure, in the title (framed blue rectangle) is the 3rd day 9 was split into two lines and grid can be colored as: red, blue, ... the name of a grid control on the name?
http://www.crocko.com/E4517D1F93C34B85AC5820941DAE1FFC/chamcong.jpg[^]
|
|
|
|
|
Your question doesn't make any sense and I'm not installing a downloader from that site to see your image.
Post your image on a site like Flickr and rewrite your post so it makes sense and you might get somewhere.
Oh, and you might want to drop all VB6 development and move up to something that hasn't been dead for over 7 years now, like .NET.
|
|
|
|
|
I am trying to develop an application like TeamViewer but I don't how it would be. If anyone knows about this Please tell me.
|
|
|
|
|
|
Hi Friends
I'm working on a project that Read & Write from COM ports.
http://s2.picofile.com/file/7680529565/03_05_2013_11_44_28_%D8%A8_%D8%B8.jpg
But i have some problems!
I define a thread in a Buttom to read from Port in Background because when i send a text to port and other device did'nt send any thing the program become hang!!
therefore :
Dim t As New Threading.Thread(AddressOf Recieve_Data)
t.IsBackground = True
t.Start()
and Recieve_Data():
Sub Recieve_Data()
While True
associatedChar = ChrW(SerialPort1.ReadByte)
RichTextBox2.Text &= SerialPort1.ReadExisting & " " & CStr(Now) & vbCrLf
RichTextBox2.SelectionStart = RichTextBox2.TextLength
RichTextBox2.ScrollToCaret()
End While
End Sub
but when i run project i receive this error:
http://s3.picofile.com/file/7680529137/03_05_2013_11_43_48_%D8%A8_%D8%B8.jpg
Complete Code is:
Public Class Form1
Dim associatedChar As Char
Dim ok As Image = Global.SadeghAPP.My.Resources.OK
Dim err As Image = Global.SadeghAPP.My.Resources.Err
Dim disconnect As Image = Global.SadeghAPP.My.Resources.Disconnect
Dim connect As Image = Global.SadeghAPP.My.Resources.Connect
Dim aboutStr As String = "Author: Sadegh Ghafoori" & vbCrLf & "Version: 1.0.0" & vbCrLf & "March 2013"
Private Sub ComboComPort_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComPortNum.SelectedIndexChanged
SerialPort1.PortName = ComPortNum.Text
If ComPortNum.SelectedIndex >= 0 Then
Message.Text = ""
BaudRateBox.Enabled = True
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendButton.Click
Try
SerialPort1.Open()
Catch
End Try
If SerialPort1.IsOpen = True Then
Message.ForeColor = Color.Green
Message.Image = ok
Message.Text = " Device Is Connected !"
RichTextBox1.Text &= DataTextBox.Text & " " & CStr(Now) & vbCrLf
RichTextBox1.SelectionStart = RichTextBox1.TextLength
RichTextBox1.ScrollToCaret()
SerialPort1.Write(DataTextBox.Text)
Else
Message.ForeColor = Color.Red
Message.Image = err
Message.Text = " Device Not Connected !"
End If
End Sub
Private Sub ConnectButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConnectButton.Click
Try
SerialPort1.Open()
Catch
End Try
If SerialPort1.IsOpen = True Then
SendButton.Enabled = True
ConnectButton.Enabled = False
DisConnectButton.Enabled = True
ComPortNum.Enabled = False
BaudRateBox.Enabled = False
ParityCombo.Enabled = False
StopBitCombo.Enabled = False
RichTextBox2.Enabled = True
RichTextBox1.Enabled = True
DataTextBox.Enabled = True
Dim t As New Threading.Thread(AddressOf Recieve_Data)
t.IsBackground = True
t.Start()
Message.ForeColor = Color.Green
Message.Image = ok
Message.Text = " Device Is Connected !"
PictureBox1.Image = connect
Else
Message.ForeColor = Color.Red
Message.Image = err
Message.Text = " Device Not Connected !"
PictureBox1.Image = disconnect
End If
DataTextBox.Select()
End Sub
Private Sub DisConnectButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisConnectButton.Click
PictureBox1.Image = disconnect
DisConnectButton.Enabled = False
RichTextBox2.Enabled = False
RichTextBox1.Enabled = False
DataTextBox.Enabled = False
SendButton.Enabled = False
BaudRateBox.Enabled = False
ConnectButton.Enabled = False
ComPortNum.Enabled = True
SerialPort1.Close()
Message.ForeColor = Color.Red
Message.Image = err
Message.Text = " Device Disonnected !"
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BaudRateBox.SelectedIndexChanged
SerialPort1.BaudRate = BaudRateBox.Text
If ComPortNum.SelectedIndex >= 0 Then
Message.Text = ""
DataTextBox.Enabled = False
SendButton.Enabled = False
RichTextBox1.Enabled = False
RichTextBox2.Enabled = False
ConnectButton.Enabled = False
StopBitCombo.Enabled = True
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
RichTextBox2.Text = ""
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.Text = ""
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
MsgBox(aboutStr)
End Sub
Private Sub ComboBox1_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StopBitCombo.SelectedIndexChanged
If StopBitCombo.Text = "One" Then
SerialPort1.StopBits = IO.Ports.StopBits.One
ElseIf StopBitCombo.Text = "OnePointFive" Then
SerialPort1.StopBits = IO.Ports.StopBits.OnePointFive
ElseIf StopBitCombo.Text = "Two" Then
SerialPort1.StopBits = IO.Ports.StopBits.Two
End If
DataTextBox.Enabled = False
SendButton.Enabled = False
RichTextBox1.Enabled = False
RichTextBox2.Enabled = False
ParityCombo.Enabled = True
End Sub
Private Sub ParityCombo_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ParityCombo.SelectedIndexChanged
If ParityCombo.Text = "None" Then
SerialPort1.Parity = IO.Ports.Parity.None
ElseIf ParityCombo.Text = "Even" Then
SerialPort1.Parity = IO.Ports.Parity.Even
ElseIf ParityCombo.Text = "Odd" Then
SerialPort1.Parity = IO.Ports.Parity.Odd
ElseIf ParityCombo.Text = "Mark" Then
SerialPort1.Parity = IO.Ports.Parity.Mark
ElseIf ParityCombo.Text = "Space" Then
SerialPort1.Parity = IO.Ports.Parity.Space
End If
ConnectButton.Enabled = True
End Sub
Private Sub Recieve_Data()
While True
associatedChar = ChrW(SerialPort1.ReadByte)
RichTextBox2.Text &= SerialPort1.ReadExisting & " " & CStr(Now) & vbCrLf
RichTextBox2.SelectionStart = RichTextBox2.TextLength
RichTextBox2.ScrollToCaret()
End While
End Sub
End Class
|
|
|
|
|
You are trying to access your Richtextbox from within a thread which isn't allowed, you need to create a delegate to make it happen
have a read of this
http://stackoverflow.com/questions/1331009/cross-thread-operation-not-valid-vb-net[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
thank
but i can't change because i'm beginner!!
plz help me to change the code
I want to show the string or text that receive from COM port
in RichTextBox2 without stop working app from other work.
|
|
|
|
|
Hi,
I developed vb6 application it is working fine in win xp,win 2003 but not running win 7(64-bit). It threw following error popup.
Component
after received this error i placed
system32 floder that OCX in win7(64bit) again it threw error popup
The module "mscomct2.ocx" may not compatible with the version of Windows that you
what i do. please help me.
|
|
|
|
|
You don't put it in System32 on a 64-bit system.
It goes in the C:\Windows\SysWow64 folder and has to be registered using REGSVR.
As for that compatibility warning message, if you continue to use VB6, you will see more and more of it as VB6 has been dead for ... lets see now ... 7 years. I HIGHLY suggest you abandon all VB6 developement and move to VB.NET. You can get a free version here[^]
|
|
|
|