|
thanx for your response.
But how can i check the machine sands one or two parameter.
|
|
|
|
|
You said ur using single textbox then u can try this
Use that textbox and send the set of value from machine(Raw Data) Once then u can understand the parameter and in that machine send weight with other tagged value.
|
|
|
|
|
remove the timer control,
wait for all parameters(one or two) from serial port with a particular time out.
use comport.readbuffercount
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
I'm converting a VB6 app which has many control label arrays (95% of them contain 2 labels) with a slew of different property values (font sizes, colors, border styles, etc). I know that control arrays are not natively supported in design mode and I don't want to use the backwards comp. VB6 reference. I recreated each label at design time, but they lack an index property. Breaking out all the logic, which is very lengthy into sep property calls vs. index isn't really practical.
My question is this: is it possible in the CTOR or load to create a label array at runtime and then set each label element = to a an existing label (those created at design time). The code below obviously doesn't work, but shows what I'm trying to accomplish. Create a 2 element lbl Array which gets set to both of the correlated labels created at design time, remove the origs, and replace with label array.
I'm confused how I can set/copy all of the orig design-time label properties = to the array labels, and then destroy the origs without killing label array values (currently a pointer to an object that doesn't exist). Is it possible to loop properties on a control?
Private lblDestination(1) As Label
Private Sub frmMainForm_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
lblDestination(0) = lblDestinationTemp
lblDestination(1) = lblDestinationBottomTemp
lblDestinationTemp.Dispose()
End Sub
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I found a way to extend the label control to include an index property.
For the sake of learning, is there a way to do the above like I was trying to do previously.
Thanks,
deez
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I would have suggested adding the controls to a collection. It seems that adding the Index property to the control is backwards, since it doesn't know it's position in a collection, nor should it care.
|
|
|
|
|
You can loop over the controls collection using the as keyword. so if 'control' is the control value as you loop
Dim lb as Label = control as Label
I think that will work. lb will be null if the control is not a label. I am translating C# in my head here, the syntax may be wrong. But, in this way, you can find all the labels in your form and do the same thing to them.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
What you have is pretty close to what you would want. There is no reason I can think of to try to "remove the originals" as all you would be doing is setting a pointer to null. Assigning the controls to the array does not make a duplicate of the control. As for setting all the properties, you could simply loop through the array after it is created to set the properties and add event handlers. It would then look something like this:
Private lblDestination() As Label
Private Sub frmMain_Load(ByVal sender as Object, ByVal e As EventArgs) Handles MyBase.Load
'I usually create the array in a single line of code. This keeps me
'from having to know the correct number of labels when initializing the array
lblDestinations = New Label() {lblDestinationTemp, lblDestinationBottomTemp}
'set properties and event handlers
For i As Integer = 0 to lblDestinations.Length - 1
lblDestinations(i).Text = "My Label " & i.ToString()
AddHandler lblDestinations(i).Click, AddressOf LabelClick
Next
End Sub
|
|
|
|
|
I think you're right. The origs would not need to be removed because of the pointer since a true copy is not being created and memory isn't really being wasted.
Sigh. Hate when the obvious things skip by sometimes
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I am working to add some additional functionality to a project and without changing anything to a particular form and DataSet object I began getting the error "There is already an open DataReader associated with this Command which must be closed first.". I am using a DataSet object that is actually part of the project which contains 2 datatables. I fill one for a large datagridview and fill the other table based on the row selection in the first. This has been working fine until today. I have already tried the "MultipleActiveResultSets=true;" parameter in the connection string and it makes no difference.
Resolution:
I just began setting the Dataset connection programmatically to override what was set at design time. I was using the same connection for both table adapters and after letting Ben's response sink in I realized what I was doing.
Thanks!
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
modified on Tuesday, November 25, 2008 2:57 PM
|
|
|
|
|
The message means exactly what is says; there is a DataReader created from the command's ExecuteReader() function that has not been closed. You'll have to trace through the code, find it and close it. I think it's common for this kind of thing to be done in a finally block, so maybe you inserted code to re-use a command object inside a try block where a DataReader is created from the command's ExecuteReader() function and has not been closed since the finally block hasn't executed.
Keep It Simple Stupid! (KISS)
|
|
|
|
|
If it was the code I wrote I would have all of that done but all I am doing is calling a TableDataAdapter that is created from the .NET Dataset to fill the local datatable contained in my instance of that dataset.
As I said before, this was not an issue, I did not change anything and am now having to track it down. Here is the code where it breaks.
<br />
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _<br />
Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"), _<br />
Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, false)> _<br />
Public Overloads Overridable Function GetCustomerDetailsCustomerDetailID(ByVal dataTable As CustomerDetail.CustomerDetailsDataTable, ByVal CustomerDetailID As Global.System.Nullable(Of Integer)) As Integer<br />
Me.Adapter.SelectCommand = Me.CommandCollection(1)<br />
If (CustomerDetailID.HasValue = true) Then<br />
Me.Adapter.SelectCommand.Parameters(1).Value = CType(CustomerDetailID.Value,Integer)<br />
Else<br />
Me.Adapter.SelectCommand.Parameters(1).Value = Global.System.DBNull.Value<br />
End If<br />
If (Me.ClearBeforeFill = true) Then<br />
dataTable.Clear<br />
End If<br />
Dim returnValue As Integer = Me.Adapter.Fill(dataTable)<br />
Return returnValue<br />
End Function
CleaKO
"Now, a man would have opened both gates, driven through and not bothered to close either gate." - Marc Clifton (The Lounge)
|
|
|
|
|
how can i delete a question i wrote?
|
|
|
|
|
Last of your post que.
ex:-
Reply,etc... [Edit/Delete]
|
|
|
|
|
i dont have these options
|
|
|
|
|
I think you are not the registered user, register yourself if not.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
There's nothing more annoying that people who delete their questions after they have been answered. What possible reason could you have to do that ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: What possible reason could you have to do that ?
Realization that you have asked question in wrong forum or if you have got flamed or whatever.
Moreover, how does VB comes into picture here?
Loading signature. Please wait...
|
|
|
|
|
Hi,
I have this file
11,misc,0008,AMM /RUH /DMM(RJ),0023,18:00-24:00,0002,RJ ,00704,AMM ,RUH ,060331,2200,000,5,001286,003,175,-01,001,006,N,000,000,000,000,000,000,000,000,000,000,Y,N,000,000,000,000,000,000000000,000000000,000000000,000,000,000.00,000,000.00,000,000
13,J,J ,001,003,175,000,000,000,Y,001,Y,N,000.00,023,000,000,000,000,000,000,000,000,Non,0000.00,0000.00,000,000,000,000,000,000.00,000.00,000,000,001.00,000.00,000.00,000,000,000,000,000,000,000,000,000,000430,N,N,N,N,-01,100,000,000,006,000,100,000,000,000,000000,000,000,000,000,000,000,000,000,000286,000286,000430
14,J,J ,023,000,000,000,000,000,000,000,024,-01,000,000,000,000,000,000
13,J,U ,002,003,175,000,000,000,Y,001,N,Y,000.00,023,000,000,000,000,000,000,000,000,Non,0000.00,0000.00,000,000,000,000,000,000.00,000.00,000,000,001.00,000.00,000.00,000,000,000,000,000,000,000,000,000,000001,N,N,N,N,-01,100,000,000,006,000,100,000,000,000,000000,000,000,000,000,000,000,000,000,000001,000001,000001
14,J,U ,023,000,000,000,000,000,000,000,024,-01,000,000,000,000,000,000
12,J,003,175,000,Y,N,000.00,000,000,000,000,000,000,000,000,000,000,000,000,000.00,000.00,000,000,000.00,000.00,001.00,000,000,000,000,000,000,000,000,000,N,N,N,N,000000000,000000000,000000000,000000000,000000000,000,000,000,000,000
13,Y,Y ,003,003,175,000,000,000,Y,003,Y,N,000.00,023,000,000,000,000,000,000,000,000,Non,0000.00,0000.00,000,000,000,000,000,000.00,000.00,000,000,001.00,000.00,000.00,000,000,000,000,000,000,000,000,000,000375,N,N,N,N,-01,100,000,000,006,000,100,000,000,000,000000,000,000,000,000,000,000,000,000,000275,000275,000375
14,Y,Y ,023,000,000,000,000,000,000,000,024,-01,000,000,000,000,000,000
13,Y,S ,004,003,175,000,000,000,Y,003,N,N,000.00,023,000,000,000,000,000,000,000,000,Non,0000.00,0000.00,000,000,000,000,000,000.00,000.00,000,000,001.00,000.00,000.00,000,000,000,000,000,000,000,000,000,000253,N,N,N,N,-01,100,000,000,006,000,100,000,000,000,000000,000,000,000,000,000,000,000,000,000124,000124,000253
14,Y,S ,023,000,000,000,000,000,000,000,024,-01,000,000,000,000,000,000
13,Y,N ,005,003,175,000,000,000,Y,004,N,N,000.00,023,000,000,000,000,000,000,000,000,Non,0000.00,0000.00,000,000,000,000,000,000.00,000.00,000,000,001.00,000.00,000.00,000,000,000,000,000,000,000,000,000,000243,N,N,N,N,-01,100,000,000,006,000,100,000,000,000,000000,000,000,000,000,000,000,000,000,000207,000207,000243
14,Y,N ,023,000,000,000,000,000,000,000,024,-01,000,000,000,000,000,000
13,Y,M ,006,003,175,000,000,000,Y,005,N,N,000.00,023,000,000,000,000,000,000,000,000,Non,0000.00,0000.00,000,000,000,000,000,000.00,000.00,000,000,001.00,000.00,000.00,000,000,000,000,000,000,000,000,000,000227,N,N,N,N,-01,100,000,000,006,000,100,000,000,000,000000,000,000,000,000,000,000,000,000,000185,000185,000227
14,Y,M ,023,000,000,000,000,000,000,000,024,-01,000,000,000,000,000,000
13,Y,H ,007,003,175,000,000,000,Y,006,N,N,000.00,023,000,000,000,000,000,000,000,000,Non,0000.00,0000.00,000,000,000,000,000,000.00,000.00,000,000,001.00,000.00,000.00,000,000,000,000,000,000,000,000,000,000210,N,N,N,N,-01,100,000,000,006,000,100,000,000,000,000000,000,000,000,000,000,000,000,000,000111,000111,000210
14,Y,H ,023,000,000,000,000,000,000,000,024,-01,000,000,000,000,000,000
13,Y,B ,008,003,175,000,000,000,Y,007,N,N,000.00,023,000,000,000,000,000,000,000,000,Non,0000.00,0000.00,000,000,000,000,000,000.00,000.00,000,000,001.00,000.00,000.00,000,000,000,000,000,000,000,000,000,000190,N,N,N,N,-01,100,000,000,006,000,100,000,000,000,000000,000,000,000,000,000,000,000,000,000166,000166,000190
14,Y,B ,023,000,000,000,000,000,000,000,024,-01,000,000,000,000,000,000
13,Y,G ,011,003,175,000,000,000,Y,010,N,Y,000.00,023,000,000,000,000,000,000,000,000,Non,0000.00,0000.00,000,000,000,000,000,000.00,000.00,000,000,001.00,000.00,000.00,000,000,000,000,000,000,000,000,000,000001,N,N,N,N,-01,100,000,000,006,000,100,000,000,000,000000,000,000,000,000,000,000,000,000,000001,000001,000001
14,Y,G ,023,000,000,000,000,000,000,000,024,-01,000,000,000,000,000,000
13,Y,V ,012,003,175,000,000,000,Y,011,N,N,000.00,023,000,000,000,000,000,000,000,000,Non,0000.00,0000.00,000,000,000,000,000,000.00,000.00,000,000,001.00,000.00,000.00,000,000,000,000,000,000,000,000,000,000170,N,N,N,N,-01,100,000,000,006,000,100,000,000,000,000000,000,000,000,000,000,000,000,000,000106,000106,000170
14,Y,V ,023,000,000,000,000,000,000,000,024,-01,000,000,000,000,000,000
13,Y,X ,013,003,175,000,000,000,Y,012,N,Y,000.00,023,000,000,000,000,000,000,000,000,Non,0000.00,0000.00,000,000,000,000,000,000.00,000.00,000,000,001.00,000.00,000.00,000,000,000,000,000,000,000,000,000,000001,N,N,N,N,-01,100,000,000,006,000,100,000,000,000,000000,000,000,000,000,000,000,000,000,000001,000001,000001
14,Y,X ,023,000,000,000,000,000,000,000,024,-01,000,000,000,000,000,000
14,Y,T ,023,000,000,000,000,000,000,000,024,-01,000,000,000,000,000,000
12,Y,003,175,000,Y,N,000.00,000,000,000,000,000,000,000,000,000,000,000,000,000.00,000.00,000,000,000.00,000.00,0
i need to read the lines that start with 11 first, then the ones that starts with 12, then 13 and ignore 14...
i started with this code:
'Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser("C:\hi.txt")
' MyReader.TextFieldType = FileIO.FieldType.Delimited
' MyReader.CommentTokens = New String() {"14"}
' MyReader.SetDelimiters(",")
' Dim currentRow As String()
' Dim test As String = ""
' While Not MyReader.EndOfData
' currentRow = MyReader.ReadFields()
' Dim currentField As String
' For Each currentField In currentRow
'
' test &= currentField & " "
' TextBox2.Text = test
'
' End If
' Next
' End While
'End Using
can anyone help me?
|
|
|
|
|
Hi,
You can read this file in to one temperary dataset and datatable.
By checking the values in the cells you can read whichever row you want.
This is one easiest way, may be if you can find any more effective ways to
do it for improving performance do little much research.
But the easiest way is which I have shown you.
Thanks a Lot,
Aleem Mohammad.
Thanks & Regards,
Md. Abdul Aleem
NIIT technologies
|
|
|
|
|
i wanna read them so i can insert them in a database starting with lines 11, then insert 12 , then 13
|
|
|
|
|
Unless you need data from lines starting 11 to use in lines starting 12 etc then there is no need to read them in a specific order - when you retrieve the data from the database do an order by. That is one of the advantages of a database.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Actually i need data from 11 to use in 12, the whole idea is to read line 11 insert it into database, then insert the 12 related to that 11 into database, then the 13 that are related to them
|
|
|
|
|
In which case why not read the entire file and store the different record types in (say) dictionaries so you can jus use them as required.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Why not read them all with file.readalllines, then build a map of lists of strings and thus sort them according to the sets you're after, and then work through those lists ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|