|
http://vbcity.com/forums/topic.asp?tid=70485RID205981
|
|
|
|
|
Hi Guys, Can anyone provide me with the best method to use for my new project: My new project must send data from a standard PC to a sql database on a web server then that data to be retrieved by a PDA, updated, then sent back to the sql database and then back to the standard PC again, I don’t know if I should use web services, sql synchronization or another method, The data that I will be sending will be XML, about 1 A4 sheet size, but I will be sending about 2 thousand per day.
|
|
|
|
|
|
How could i re-write this code more effective
i aim to do this
if number is 234 , result will be 234.00
if number is 1234 , result will be 1,234.00
if number is 1234.4 , result will be 1,234.40
if number is 1234.45 , result will be 1,234.45
if number is 1234.4522 , result will be 1,234.4522
if number is 1234.452284 , result will be 1,234.4523
Shared bNumberIsNegative As Boolean = False<br />
Public Shared Function SetComma(ByVal dblNumber As Double) As String<br />
Try<br />
If dblNumber < 0 Then bNumberIsNegative = True Else bNumberIsNegative = False<br />
dblNumber = Math.Abs(dblNumber)<br />
dblNumber = Math.Round(dblNumber, 4)<br />
Dim dblNumberWithOutComma As String = dblNumber.ToString<br />
Dim strNumberWithComma As String = ""<br />
Dim shrDotIndex As Short = dblNumberWithOutComma.IndexOf(".")<br />
Dim i As Integer<br />
Dim k As Integer<br />
If shrDotIndex = -1 Then shrDotIndex = dblNumberWithOutComma.Length<br />
For i = shrDotIndex - 1 To 0 Step -1<br />
k = shrDotIndex - 1 - i<br />
If (k Mod 3) = 0 And Not k = 0 Then strNumberWithComma = "," & strNumberWithComma<br />
strNumberWithComma = dblNumberWithOutComma.Chars(i) & strNumberWithComma<br />
Next<br />
strNumberWithComma &= dblNumberWithOutComma.Substring(shrDotIndex, dblNumberWithOutComma.Length - shrDotIndex)<br />
Select Case dblNumberWithOutComma.Length - shrDotIndex<br />
Case 0 : strNumberWithComma &= ".00"<br />
Case 2 : strNumberWithComma &= "0"<br />
End Select<br />
If bNumberIsNegative Then strNumberWithComma = "-" & strNumberWithComma<br />
Return strNumberWithComma<br />
Catch ex As Exception<br />
<br />
End Try<br />
End Function
-- modified at 7:45 Thursday 13th October, 2005
|
|
|
|
|
Try using the Format Function:
Format(myNumber, "#,##.00##")
Hope this helps
Tom
|
|
|
|
|
Hi,
I would like to know if it's possible to pass array variable to a VB DLL. I managed to create an ActiveX DLL on VB and convert it to Windows DLL by including a .def file to the VB linker.
I have no problem passing variable to the functions in the VB DLL. When comes to passing array to the subroutine, my program crashes. What I want to do is to have a subroutine in the DLL file to do some processes and update an array of variable (which I passed to it) with data so that EXE can make use of these array variables' data.
Below is one of a sub in the DLL file that I created,
****************************************
Public Sub WriteReport(OutputReportData() As Byte)
'Send data to the device.
Dim Count As Integer
Dim NumberOfBytesRead As Long
Dim NumberOfBytesToSend As Long
Dim NumberOfBytesWritten As Long
Dim ReadBuffer() As Byte
Dim SendBuffer() As Byte
'The SendBuffer array begins at 0, so subtract 1 from the number of bytes.
ReDim SendBuffer(Capabilities.OutputReportByteLength - 1)
'******************************************************************************
'WriteFile
'Sends a report to the device.
'Returns: success or failure.
'Requires: the handle returned by CreateFile and
'The output report byte length returned by HidP_GetCaps
'******************************************************************************
'The first byte is the Report ID
SendBuffer(0) = 0
'The next bytes are data
For Count = 1 To Capabilities.OutputReportByteLength - 1
SendBuffer(Count) = OutputReportData(Count - 1)
Next Count
NumberOfBytesWritten = 0
Result = WriteFile _
(HIDHandle, _
SendBuffer(0), _
CLng(Capabilities.OutputReportByteLength), _
NumberOfBytesWritten, _
0)
'Call DisplayResultOfAPICall("WriteFile")
'lstResults.AddItem " OutputReportByteLength = " & Capabilities.OutputReportByteLength
'lstResults.AddItem " NumberOfBytesWritten = " & NumberOfBytesWritten
'lstResults.AddItem " Report ID: " & SendBuffer(0)
'lstResults.AddItem " Report Data:"
'For Count = 1 To UBound(SendBuffer)
' lstResults.AddItem " " & Hex$(SendBuffer(Count))
'Next Count
End Sub***********************************************
The DLL crashed when it execute the following statement,
For Count = 1 To Capabilities.OutputReportByteLength - 1
SendBuffer(Count) = OutputReportData(Count - 1)
Next Count
It gives type mismatch. I believe the mismatch should be on the OutputReportData(). Of course on the EXE program declaration part, I declare OutputReportData by reference as follow,
Public Declare Sub WriteReport Lib "USBLib.dll" (ByRef OutputReportData As Byte)
I declared OutputReportData as public array,
Public OutputReportData(8) As Byte
On the calling sub statement side, I passed the OutputReportData array argument to the DLL subroutine as follow,
WriteReport OutputReportData(0)
Can someone please tell me what's wrong with my code? Thanks!
|
|
|
|
|
How i trap ok and cancel button value in inputbox function
himanshu
|
|
|
|
|
how to report the bugs together with program status such as procedure name, call stack, code line and variable contents
sanjay
|
|
|
|
|
read about exception handling. That class holds the info you are looking for.
|
|
|
|
|
In which language are you working?
VB6 - afaik you will need to custom write something, there is no support for this 'straight out of the box'
VB.Net
Look at the stacktrace and stackframe classes. They provide all the information. NOTE: if using exception handling, the exception object includes a stacktrace.
Alan.
|
|
|
|
|
Is there any way to make the size of a Windows UserControl dynamic?
|
|
|
|
|
Using the anchor attribut fixed the problem
|
|
|
|
|
hi..
i hav a window application ..i wan to add values in value field of combobox to the each corresponding text(item) how can i do that
|
|
|
|
|
use the .ValueItem property of the combobox..
and if you dont know how........try Google
_mubashir
|
|
|
|
|
|
Hi,
i am using crystal reports for .net and i want to create a report with a sub report.
The subreport should be shown on an own tab page.
How can I do this
Thank's
Jens
|
|
|
|
|
hi guys .. how are you ? .. am a fresh guy around here
i wish that i could find an answer of my question here
anyway... am about to develop a VB.NET network program
it's about (remote access over lan & lan messenger)
my question is that " WHAT ARE ALL POSSIBLE LIBRARIES THAT MAY HELP ME TO DEVELOP SUCH A PROGRAM LIKE THAT? "
------------------------------------------
here is a brief description of the program :
The program can be applied on any computers’ network lab. Environment (any location with computers connected to each other, e.g. network Lab. at schools, colleges, training centers).
• The main functions that the program is meant to do :
1- Remote access and control are being done from administrator (instructor) computer to clients’ (students’) computers, by enabling active sessions between them.
2- Monitoring the behavior and the activities that have been done on clients (students) computers, by using log files.
3- Communications between clients (students) and the administrator (instructor), by using chat sessions.
4- Simplify administration process, by creating user accounts and giving them appropriate privileges and permissions.
THANK YOU .. YOURS ABUASSAD
|
|
|
|
|
Hi... can anybody show me how to read text file that will return the desired value to ms excel format.
Just to give a bit background that I need to do. I have a source file which is text format. I need to read that text document and return the specific information that I want to my excel format. My excel has already a designed template where I will put the information from the text file in a certain field/row/cell in my excel.
Appreciate you kind help and your quick response on this.
Many thanks in advance.
|
|
|
|
|
You could cheat... Open Excel and your spreadsheet, start recording a macro, simulate the text you want to add manually in the spreadsheet then look at the code the macro created.
This should give you a good starting point for automating Excel, If you get stuck with specifics post here and I'll help out.
Hope this helps
Tom
|
|
|
|
|
Hi tom thanks I really appreciate your help.
I got your instructions but I still have many questions. Once I recorded the manual filling of the records I want to transfer from text file to excel, whats next?
The source file is changing monthly. I mean the positioning of the specific record in the text file is changing. Will this way still work?
Thanks.
|
|
|
|
|
anybody who can help me on this thing! Thanks
|
|
|
|
|
adding my program to currnetUser\...\Run in the registry...
causing the debuger to run with TypeIntialize Exception in Unknow Module...
my program has a sub main in a module...
so someone tell me what is the problem and how to deal with it?
militiaware
|
|
|
|
|
be more specific. you get the error only if you run the program at the startup or every time you launch the exe? What's exactly the error (full reference)
|
|
|
|
|
this problem appears only when the windows startup... and no problems comeout when i run the program directly on double click .
when the Windows starts... a new instance of the debugger run.. then it come out with this message:
An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module.
Additional information: The type initializer for "MyProgram.MyModule" threw an exception.
so what's the problem?
militiaware
|
|
|
|
|
Thus it should be a missing module (or at least that way sounds to me). You normally get that error when the system cannot create or load a specific object. Normally something you declared from an external reference (i.e. Dim myTAPI as TapiLib.TAPI where the TapiLib stays in a specific DLL).
Now since you get that error it seems that the reference goes to something that is not available/initialized at the time your programs load. So my suggestion is have a look at the reference in your assembly and see how do they are loaded.
|
|
|
|