|
Try searching Google for "Bluetooth VB.NET", I expect there are lots of samples out there.
It's time for a new signature.
|
|
|
|
|
|
Hi,
I am using a scanner , that scaner raise an event when scanning a data .
I have got a function listening this event and when the event is raised, it launch a form.
<br />
private sub INIT()<br />
addhandler scandone, addressof afficherForm<br />
end sub<br />
<br />
<br />
<br />
Private sub scan ()<br />
raiseEvent ScanDone<br />
end sub<br />
<br />
<br />
Private sub AfficherForm() <br />
Dim myform as new form<br />
myform.showdialog<br />
end sub<br />
the problem is, i can't scan anymore when my event is raised and while ma new form is running, i have to exit the "new thread" to be able to scan again.
How can i resolve this problem please ?
thanks
|
|
|
|
|
There's not enough here to determine what your actually doing with these pieces of code (like the form you launched), but the most obvious reason why would be that ShowDialog is a blocking call. No other code will execute until that dialog is dismissed. If this is not what you want, change the ShowDialog to Show. Show does not block. The code after it will continue to execute with the new form still showing.
As a side, whenever you show a form with ShowDialog, you are also responsible for calling Dispose on it when you're done with it. Your code doesn't do that anywhere and will leak resources if it's not fixed.
|
|
|
|
|
For some other reason i have to use the ShowDialog mode.
But i guess it is possible to launch the new form not in the thread that launch the event but from the one of the main form.
It blocks because the form is launched from the scanner thread so the scanner is bloqued.
How can i resolve this ?
|
|
|
|
|
The scanner is using a background thread internally. The library is raising the events on the UI (start up) thread. It may be possible to move the scanner component to a background thread also, but you may also run into problems with that. The people who can answer that question are the people who made the scanner and its SDK.
thesum wrote: But i guess it is possible to launch the new form not in the thread that launch the event but from the one of the main form.
You cannot launch forms on anything other that the startup thread. SO, you have another problem. You cannot launch a new form for every scanned page while the first one is still active. You cannot show form after form after form from that event handler because ShowDialog will block and prevent the handler from executing again until the dialog is dismissed. You simply have not choices here. You have to change the design of your app, specifically, change the ShowDialog to Show.
|
|
|
|
|
Yes i understand, but i would like to launch the form from the starup thread and before making my showdilog i would make a removeHandler for my scanner Event.
One solution is to create a timer.
Enable the timer when the scan is done, and in the Time_Tick event, launch my new form (and removeHandler of my scanner).
There are no other way to do this method by other way than using a Timer ?
|
|
|
|
|
thesum wrote: Enable the timer when the scan is done, and in the Time_Tick event, launch my new form
So you're trying to launch the new form on a seperate thread? Not going to work and is pointless.
The whole point behind a ShowDialog call is to stop execution of the code until the dialog is dismissed. Why are you saying that you need to use ShowDialog, but yet not block the code?
|
|
|
|
|
How to read the contents of a PDF in VB.Net
|
|
|
|
|
|
I am using visual studio 2005, 2008.
And now i am converting visual basic6.0 to vb.net.
Strptr function don't be convertet.
So how can i convert?
below is source.
Public Function AToW(ByVal st As String)
Dim pwz As Integer
pwz = StrPtr(st)
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
|
Hi mates,
I have an unbound datagridview which has bound combobox and an insert button for inserting new row.
The problem is when I input data in row 1 it will move to row 3
after hitting enter key.
Example.
--------------------------------------
column1 | column2(boundcombox)
--------------------------------------
row1 | ----> inserted row
--------------------------------------
row2 | ----> inserted row
--------------------------------------
row3 test | 112 ---->original row
--------------------------------------
Note: I have an event that will automatically
fill the data in column2, when input in column1.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
Can you show us the code you used to insert the row?
|
|
|
|
|
Heres the code for inserting a new row, it will insert in the middle of two rows, it just NOT insert at the last. it will insert any row you want.
then recount the sequence no.
Private Sub btnInsRow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsRow.Click
Dim posRow, seq As Integer
Dim iRow As Integer
Dim dRow As DataRow = dttable.NewRow
Try
If Me.C1tdbgridAnalyze.RowCount <> 0 Then
If Me.C1tdbgridAnalyze.Item(Me.C1tdbgridAnalyze.Row, 4) < 96 Then
With Me.C1tdbgridAnalyze
dRow("OrderNo") = .Item(.Row, 0)
dRow("ItemNo") = .Item(.Row, 1)
If .Row = 0 Then
posRow = .Row
dRow("SeqNo") = .Item(.Row, 4)
seq = dRow("SeqNo")
Else
posRow = .Row + 1
dRow("SeqNo") = .Item(.Row, 4) + 1
seq = dRow("SeqNo")
End If
dttable.Rows.InsertAt(dRow, posRow)
.Row = posRow
.DirectionAfterEnter = C1.Win.C1TrueDBGrid.DirectionAfterEnterEnum.MoveDown
.Col = 0
.Select()
iRow = seq
For seqRow As Integer = 0 To .RowCount
If seqRow >= posRow Then
If .Item(seqRow, 4) <> Nothing Then
.Item(seqRow, 4) = iRow
End If
iRow += 1
End If
Next
End With
End If
End If
Catch ex As Exception
log.Debug(ex.ToString)
Throw ex
End Try
End Sub
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
C#Coudou wrote: Me.C1tdbgridAnalyze.RowCount <> 0
I would personally not check for 0 rows, but test for less than or equal to 0 ie <=0
C#Coudou wrote: For seqRow As Integer = 0 To .RowCount
Will .RowCount not exceed the bounds for a 0 based collection, should it not be .RowCount - 1
You are more than just interacting with a unbound datagrid here, should you not first start with the insert operation and then update the other controls. e.g. dttable, c1tbdgridAnalyze
C#Coudou wrote: posRow = .Row + 1
You then try to insert at position posRow, this is outwith the bounds of the rows collection as this position does not insert exist, if you are on the last row, do you not need to use an AddRow method (not sure exactly which type of control you are using. are you using a standard System.Windows.Forms.DataGridView?
A standard DGV has both an Rows.Add() and a Rows.Insert(position) method for working with the rows collection.
|
|
|
|
|
daveauld wrote: are you using a standard System.Windows.Forms.DataGridView?
No, I'm using component one, the C1TrueDBGrid. Actually my code for inserting row at any position is working. My only problem is when inputting data on the added rows. Ie; i have added two new rows then input data, the data goes to old row when I hit enter key.
My goal is to insert/add a row at any position whether at the first row, middle of two rows, and last row.
I've tried the System.Windows.Forms.DataGridView but it will insert only at the last row, if you have a code that can insert/add at any position. It really can help my problem.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
Dear sir,
I have 2005 vb.net Solution, lately when i edit any thing in crystal reports i get build error, i use windows 7 ultimate, when i open the same application in windows xp in the same path it work fine, it also work fine in windows 7 if i open the solution using vs.net 2008.
Here is the build error:
Error 1 The "ResolveAssemblyReference" task failed unexpectedly.
System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
at System.IO.Path.SafeSetStackPointerValue(Char* buffer, Int32 index, Char value)
at System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)
at System.IO.Path.NormalizePath(String path, Boolean fullCheck)
at System.IO.Path.GetDirectoryName(String path)
at Microsoft.Build.Tasks.SystemState.FileExists(String path)
at Microsoft.Build.Tasks.Resolver.FileMatchesAssemblyName(AssemblyNameExtension assemblyName, Boolean isPrimaryProjectReference, Boolean wantSpecificVersion, Boolean allowMismatchBetweenFusionNameAndFileName, String pathToCandidateAssembly, ResolutionSearchLocation searchLocation)
at Microsoft.Build.Tasks.Resolver.ResolveAsFile(String fullPath, AssemblyNameExtension assemblyName, Boolean isPrimaryProjectReference, Boolean wantSpecificVersion, Boolean allowMismatchBetweenFusionNameAndFileName, ArrayList assembliesConsideredAndRejected)
at Microsoft.Build.Tasks.Resolver.ResolveFromDirectory(AssemblyNameExtension assemblyName, Boolean isPrimaryProjectReference, Boolean wantSpecificVersion, String[] executableExtensions, String directory, ArrayList assembliesConsideredAndRejected)
at Microsoft.Build.Tasks.DirectoryResolver.Resolve(AssemblyNameExtension assemblyName, String rawFileNameCandidate, Boolean isPrimaryProjectReference, Boolean wantSpecificVersion, String[] executableExtensions, String hintPath, String assemblyFolderKey, ArrayList assembliesConsideredAndRejected, String& foundPath, Boolean& userRequestedSpecificFile)
at Microsoft.Build.Tasks.AssemblyResolution.ResolveReference(IEnumerable`1 jaggedResolvers, AssemblyNameExtension assemblyName, String rawFileNameCandidate, Boolean isPrimaryProjectReference, Boolean wantSpecificVersion, String[] executableExtensions, String hintPath, String assemblyFolderKey, ArrayList assembliesConsideredAndRejected, String& resolvedSearchPath, Boolean& userRequestedSpecificFile)
at Microsoft.Build.Tasks.ReferenceTable.ResolveReference(AssemblyNameExtension assemblyName, String rawFileNameCandidate, Reference reference)
at Microsoft.Build.Tasks.ReferenceTable.SetPrimaryAssemblyReferenceItem(ITaskItem referenceAssemblyName)
at Microsoft.Build.Tasks.ReferenceTable.SetPrimaryItems(ITaskItem[] referenceAssemblyFiles, ITaskItem[] referenceAssemblyNames, ArrayList exceptions)
at Microsoft.Build.Tasks.ReferenceTable.ComputeClosure(DependentAssembly[] remappedAssembliesValue, ITaskItem[] referenceAssemblyFiles, ITaskItem[] referenceAssemblyNames, ArrayList exceptions)
at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute(FileExists fileExists, DirectoryExists directoryExists, GetDirectories getDirectories, GetAssemblyName getAssemblyName, GetAssemblyMetadata getAssemblyMetadata, GetRegistrySubKeyNames getRegistrySubKeyNames, GetRegistrySubKeyDefaultValue getRegistrySubKeyDefaultValue, GetLastWriteTime getLastWriteTime)
at Microsoft.Build.Tasks.ResolveAssemblyReference.Execute()
at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound) UniqueFMS
Thank you for help
|
|
|
|
|
It looks like it is were one of the assemblies are installed is in a path that is too deep. (Second line of the stack)
You will need to check which assembly is failing and adjust its location to resolve the issue.
|
|
|
|
|
thanks for quick reply, but the same solution work fine when i open windows xp , same files paths ?!!!!
|
|
|
|
|
shereen_shf wrote: same files paths
not necessarily. Some system files could be at different positions; your app may be at a different location (assuming different systems); user files may depend on special folders such as "Documents and Settings" which move around and vary by the Windows version.
And anyway, having it work under some conditions does not mean everything is fine. You may have disobeyed an existing rule or guideline with no adverse effects on XP, and problems on Vista/Win7.
|
|
|
|
|
It would be SO helpful if Microsoft added "Data in Error" info to this message. Then it would save hours of head scratching.
|
|
|
|
|
Just make sure the path does not exceed 260 chars.
And Windows7 paths are a bit different then xp's
Maximum Path Length Limitation
In the Windows API (with some exceptions discussed in the following paragraphs), the maximum length for a path is MAX_PATH, which is defined as 260 characters. A local path is structured in the following order: drive letter, colon, backslash, name components separated by backslashes, and a terminating null character. [Source msdn]
|
|
|
|
|
Hello
I have an application, customers via amending Script. This application handles a message screen that lets you send any alerts in a different way to "msgbox", however this screen sometimes overlaps with the others in the application and the message can not be seen. Does anyone know why this happens and how to solve it?
Thanks...
|
|
|
|
|
When you display a Form using Show() or ShowDialog() or a real MessageBox by calling its Show() method, there are several overloads of the method; some of them accept an IWin32Window parameter, where you can pass "this" (indicating the caller's form); as a result the new form/messagebox will be owned by "this", always be in front of it, and disappear together with it (e.g. when "this" gets minimized). I recommend using such ownership all the time.
|
|
|
|
|