|
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.
|
|
|
|
|
|
zimvbcoder wrote: this == Me (VB)
yeah, I meant you Me, not this.
Like you meant = not == which doesn't exist in VB.
|
|
|
|
|
In a case that I dealt with I had to create a hidden dummy form and set it to top most then set the message box to use the dummy form as the parent for the message box...
That will always make it come to the top.
Humble Programmer
|
|
|
|
|
Hi,
I set my culture as like the following manner
Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-GB", False)
Dim Dt2 As DateTime = MaskedTextBox1.Text
'Dim Dt2 as DateTime=CDate(MaskedtextBox1.Text)
Dim GnQy As Object = MyDs.Tables(0).Compute("sum(grn_qty)", "itm_code='" & ThsImCd & "' and grn_date<='" & Dt2 & "'")
Getting Error Message "Cannot perform <= operation on System.DateTime and System.String"
I become tired to understand the error.
Thanks
|
|
|
|
|
I suspect that your problem is that you are asking for a DateTime to be concatenated with a string . Try changing as follows:
Dim GnQy As Object = MyDs.Tables(0).Compute("sum(grn_qty)", "itm_code='" & ThsImCd & "' and grn_date<='" & Dt2<big>.ToString()</big> & "'")
I have bolded the change.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas? - Because 31 Oct = 25 Dec.
Business Myths of the Geek #4 'What you think matters.'
|
|
|
|
|
I'm not sure the problem is to do with the string concatenation. In my experience, the VB.NET compiler will automatically invoke the ToString() method whenever a non-string variable is included in a string concatenation.
It is far more likely that it is how you are including the DateTime variable in the query parameter of the Compute() method. In both Microsoft Access and Microsoft SQL Server, including a date in a query string requires wrapping the date in # characters, not ' characters.
Try changing your query to:
Dim GnQy As Object = MyDs.Tables(0).Compute("sum(grn_qty)", "itm_code='" & ThsImCd & "' and grn_date<=#" & Dt2 & "#")
I have also bolded my changes.
|
|
|
|
|
Hi,
I have two comments:
1.
when dealing with dates and times, you should use the relevant classes, and avoid string operations as much as possible. So if the initial date information is in string format, turn it into a DateTime as soon as possible (using TryParse), then take advantage of all the methods and properties DateTime offers.
2.
Paramu1973 wrote: Dim Dt2 As DateTime = MaskedTextBox1.Text
You should not base your code on those implicit conversions, as they tend to hide potential problems that will bite you sooner or later at run-time. I suggest you start each file with "Option Strict On" (that may generate a couple of surprise messages, each of them needing a fix), then explicitly code the conversions you need (e.g. using DateTime.TryParse). For TextBoxes and other input Controls, be aware they may be empty (hence fail conversion), or contain unacceptable input (even a pretty good MaskedTextBox may accept a "February 31" which will cause havoc later.
|
|
|
|
|