|
Thank everyone for you responses I'll try to reply to all in this one posting
Unfortunately, I am stuck with Access it is a third party package with paid support. I agree that this is a very poor design. I spoke to the vendor and they have been working on a SQL version for YEARS
I know file copy is not ideal but, as soon as the application opens it locks all of the DB's, so i can't query. If it were SQL I could at least do a dirty read, but I can't find away to do that in Access. So I'm kinda forced to use File copy. actually Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal
lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long)
Monthly copies are on tables that rarely change if ever.(Just being safe)
Daily copies are on tables that hold system settings that are changes when then customer requirements change. Software controls machinery via 32 serial ports.
30sec copies are probably over kill. A new item is produced every 5 minutes, these DB's hold the characteristics of each every piece made.
Network Issues----- what do you think about placing copies of the tables on the fail over box in a separate folder. Then test for conditions such as update time and then copying into the correct locations if conditions are met?
Again thanks everyone for you responses.
|
|
|
|
|
Background: I have a class wrapping httpwebrequest/response and executing on it's own thread with an event handler for DataArrival.
I have 2 web addresses I can use. 1 is with test data and 1 is an internal site with the real data. If i run the code on the production machine the site will fail (since it's not on the internal network) but it works fine with the test site. When the internal site fails it just returns a webpage from opendns saying it can't find the site (which is what should happen), but for some reason it crashes the program.
ModemTests - is a string array holding the information coming in (currently only using index 0)
ShowModem - this is the sub where the data gets processed
Public Sub Modem_DataArrival(ByVal sender As Object, ByVal e As DataArrivalEventArgs)
ModemTests(0).ModemInfo += e.RecievedData 'there is data in here when it crashes
If e.IsComplete Then
If ShowingModem = sender.tag Then
ModemTests(0).ModemRunning = False
Dim d As New SetTextCallback(AddressOf ShowModem)
Invoke(d, New Object() {ModemTests(0).ModemInfo}) 'error occurs here
End If
End If
End Sub
Crash error:
System.ArgumentOutOfRangeException was unhandled
Message="Length cannot be less than zero. Parameter name: length"
ParamName="length"
Source="System.Windows.Forms"
StackTrace:
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
at ConnectionTools.frmMain.Modem_DataArrival(Object sender, DataArrivalEventArgs e) in D:\VS2008\WindowsApplication10\WindowsApplication10\frmMain.vb:line 72
at ConnectionTools.HttpRequestResponse.OnDataArrival(DataArrivalEventArgs e) in D:\VS2008\WindowsApplication10\WindowsApplication10\clsHttpRequest.vb:line 51
at ConnectionTools.HttpRequestResponse.ReadCallBack(IAsyncResult asyncResult) in D:\VS2008\WindowsApplication10\WindowsApplication10\clsHttpRequest.vb:line 199
at System.Net.LazyAsyncResult..ctor(Object myObject, Object myState, AsyncCallback myCallBack, Object result)
at System.Net.ConnectStream.BeginReadWithoutValidation(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.BeginRead(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at ConnectionTools.HttpRequestResponse.ReadCallBack(IAsyncResult asyncResult) in D:\VS2008\WindowsApplication10\WindowsApplication10\clsHttpRequest.vb:line 191
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.ContextAwareResult.CompleteCallback(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.ContextAwareResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
InnerException:
|
|
|
|
|
At a guess, I would say that ModemTests is not being initialized properly as an array. The String class has a default property such that MyString(x) returns the xth character; if MyString has no characters, you will get his error.
Added
I ran these two tests:
Dim s As String() = {}
Debug.WriteLine(s(0))
Dim s As String = ""
Debug.WriteLine(s(0))
Both returned IndexOutOfRangeException , which seems to blow my theory. The only other thing I can think of is that the problem is with the value of e.ReceivedData . You might want to stick in some diagnostic code to check the value before doing the assignment.
modified on Thursday, April 2, 2009 4:04 PM
|
|
|
|
|
I have this on form load, everything should be fine in the array.
For i As Integer = 0 To 4
ModemTests(i).ModemInfo = ""
ModemTests(i).Ping1Info = ""
ModemTests(i).Ping2Info = ""
ModemTests(i).SMTInfo = ""
ModemTests(i).ModemRunning = False
ModemTests(i).Ping1Running = False
ModemTests(i).Ping2Running = False
ModemTests(i).SMTRunning = False
Next
The thing is, it works fine with the test site. If i just change the site it crashes. I just don't know what the error wants from me. I've even tried passed just some text instead of a variable to the Invoke and it still gives the error.
|
|
|
|
|
Ok, i think i found the problem. The errors are occurring the ShowModem sub but for some reason are showing up as occurring at the Invoke statement.
Is there any way to disable the Threading check so you don't need all that Invoke code? I don't ever remember having to do that when using threads but last time i used VB.NET was a few years ago.
|
|
|
|
|
I thought the problem was with ModemTests(0).ModemInfo += e.RecievedData . My bad.
The only think I can see that might be wrong then is that ModemTests(0).ModemInfo should hold a reference to the method ShowModem . But to be honest, I've never used delegates like this, and I am completely unfamiliar with modem handling.
|
|
|
|
|
thanks in advance
modified on Friday, April 3, 2009 7:41 AM
modified 28-Nov-12 4:43am.
|
|
|
|
|
Seems awefully familiar to this thread you started [^]a short while back, check with the posts there. No need to repost everything.
|
|
|
|
|
|
See my post here. The exact same advice applies here.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Hi,
I have a html page where i have a link and 2 radio buttons and when i click the link i need to run cmd (with selected radio button as parameter to cmd) in the background ...
Please help regarding the same...(i need to use vbscript..)
|
|
|
|
|
By Using JavaScript you can Run Command as per your requirement.
or you can use BAT file for executing Command.
Best Regard
Anubhava Dimri
mailto: anubhava.prodata@gmail.com
|
|
|
|
|
Set wShell = WScript.CreateObject("WScript.Shell")
wShell.Run "c:\windows\system32\calc.exe" Google is your friend, my friend
I are troll
|
|
|
|
|
|
patricemburu wrote: anyone with vb 6.0 code for netmeeting or knows where i can get it?
Nobody is just going to give you code.
I don't know what you mean by 'netmeeting' but if its a program, other developers worked hard on it to create it so by just requesting there work (code) your requesting to steal from them.
patricemburu wrote: pls
you have a full keyboard, use it.
patricemburu wrote: patricemburu@yahoo.com
NEVER a good idea to put your email into a forum post.
There is an email button (just as there is a reply button).
patricemburu wrote: vb 6.0
It's dead and unsupported, so why on earth would you still use it.
|
|
|
|
|
Right
- NetMeeting was not written in VB 6.0. If anything, it would have been written in C, C++ or assembler
- There is no comparison between those languages
- Stealing code is considered unethical or illegal
- Capitalisation is rather useful
- Your keyboard is not locked into the phrase 'pls'
- Posting your email is unwise for the following reasons:
- Spambots
- If you get the code, no-one else can learn from your question
|
|
|
|
|
VB6 is obsolete and unsupported. Why are you still using it ( or, that is, still trying to rip off code written in it ) ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Hi,
I program in lots of languages but a few days ago I have had a go at programming in VB.net 2008 (express edition for now).
I have got an application up and running but there is an odd difference between the "debug" and 'release" version.
Both work but when I activate the "OpenFileDialog" in the "Debug" version I get a nice size "open file" window that can easily be resized.
When I do the same in the "release" version I get an equally functional "open file" window but it is always "full screen" and cannot be resized at all.
I am new to "VB.NET" and I have looked in lots of places on the internet for a tip on this but have not found anything. Can anyone point me in the right direction ?
Any help much appreciated
|
|
|
|
|
Filip Dossche wrote: but it is always "full screen" and cannot be resized at all
Wow - never seen that and I can't see any settings that would control it. Are you using a dialog dropped on the form or creating it in code?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
It is just an "Openfile" dialog that was integrated in the "designer" page and is activated by clicking a button.
It is actually derived from the 'CommonDialogs' example that came with the VB2008.Net express installation. I have not changed anything to that except for adding some extra decoding and modifying the final file content after the file has been selected and opened.
A colleague told me it could have something to do with certain settings being preset by the VB.NET developers studio when you are running the debug version and those settings being different when the application runs on its own.
As you say though I have not found anything about "OpenFile" dialog size settings or similar.
Ah well, maybe somebody will make it "glaringly obvious once pointed out" .
|
|
|
|
|
hai all,
i am using dotnet 2005 and sql server2000.i have 2 table as follow
table name as bill
cutomercode billno capacity unitmodel rate
act 101 1 ton elite plus 10
act 122 1.5 ton vertix 32
tablename as unit
cutomercode billno capacity unitmodel indoorunit outdoorunit
act 101 1 ton elite plus 232 146
act 101 1 ton elite plus 258 231
act 122 1.5 ton vertix 465 521
act 122 1.5 ton vertix 112 101
act 122 1.5 ton vertix 178 104
here cutomercode,billno,capacity,unitmodel,indoorunit,outdoorunit,rate are columns.
i wrote a command in database expert in crystal report.i passed the parameter values of customercode and billno.
i have coming as follow in crystal report print page.
SLNO capacity unitmodel
1 1 ton elite plus
indoorunit:232
outdoorunit:146
2 1 ton elite plus
indoorunit:258
outdoorunit:231
3 1.5 ton vertix
indoorunit:465
outdoorunit:521
4 1.5 ton vertix
indoorunit:112
outdoorunit:101
5 1.5 ton vertix
indoorunit:178
outdoorunit:104
the above print is wrong.mistake is repeated datas.my client expect print like 1,2,3,4 for each data as follow.i want to display as follow in crystal report print page.
SLNO capacity unitmodel
1 1 ton elite plus
indoorunit:232,258
outdoorunit:146,231
2 1.5 ton vertix
indoorunit:465,112,178
outdoorunit:521,101,104
how to print these datas in crystal report.
|
|
|
|
|
Hi,
You can use a blank table in your Database.After executing a command you can save result of data in this table.After that easily u can access table from crystal report.
Best Regard
Anubhava Dimri
mailto: anubhava.prodata@gmail.com
|
|
|
|
|
I am trying to convert a VB6 code to VB.net using VS2008. The program interfaces with excel and other programs and I have managed to get them to work ok, but get stuck when trying to call a dll I need. Have tried to follow examples without success. The dll is called NSGA2.dll and the function I want to use is called Initialize, it works fine with VB6 but not working with VB.net?
The VB6 code;
Option Explicit
Private Declare Function Initialize Lib "C:\Documents and Settings\My Documents\NSGA2.dll" (Ret1() As Double, Ret2() As Double)
Private Sub Command1_Click()
Dim Inputarrays(14) As Double
Dim DVArray() As Double
For i = 0 To 13
Inputarrays(i) = Text1(i).Text 'Takes the values from the form where there are 14 inputs
Next i
ReDim DVArray(Inputarrays(4) - 1, Inputarrays(0) - 1)
Call Initialize(Inputarrays, DVArray)
End Sub
The VB.net code;
Public Class Form1
Private Declare Function Initialize Lib "C:\Documents and Settings\My Documents\NSGA2.dll" (ByVal Ret1() As Double, ByVal Ret2(,) As Double)
Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRun.Click
Dim InputArray(13) As Double
Dim i As Integer
Dim FileName As String
Dim DVArray(,) As Double
Call GetInput(InputArray) 'Calls a Sub which takes the values from the form where there are 14 inputs
ReDim DVArray(InputArray(4) - 1, InputArray(0) + InputArray(1) - 1)
Call Initialize(InputArray, DVArray)
End Sub
Any suggestions would be grateful.
|
|
|
|
|
Do you have the source for the NSGA2.dll? If so, you could debug the VB6 version while running .Net and attempt to see where the error is occurring.
Do the bounds on DVArray match the VB6 version prior to calling Initialize?
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
I do have the original source code for the NSGA2.dll, however it was compiled in VC++6, which I don't have.
The bounds for DVArray for the VB6 version and the .net version are the same.
I'm not sure how I can debug the original source code from .net. The error I get from the .net debugger is "PInvoke restriction:cannot return variants." which occurs at the Call Initialize (InputArray, DVArray) step. It doesn't allow me to procede and therefore I can't actually go into the C++ code at all.
|
|
|
|
|