|
Thanks for the reply. Each time I tried it the program would leave the form before it was formerly closed. After much searching I eventually found the culprit. It was an incorretcly initialized variable. VB .Net did not like it, did not throw an exception and and exhibited this perculiar behaviour.
Anyway problem solved. It is now working as it should.
jenkinsdjj
|
|
|
|
|
Hi all,
Not sure if my subject is correct in describing what I want to do. I have an integer variable (iOptions) where each bit represents an On/Off Flag:
0 = all off
1 = flag1
2 = flag2
4 = flag3
8 = flag4
....... and so on
Of course this integer variable could equal to 7 (flag1+flag2+flag3 are On) or anywhere in between.
How do I write a bitwise if statement to check if anyone flag is On?
if iFlag1 ?? iOptions then ' What goes here instead of ??
...
else if iFlag2 ?? iOptions then
...
end if
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
If I got it correctly you want to check a specific bit if is on or off.
Several ways.
Tha basic one is to OR the integer with the bit mask and check if the result is (or not) 0.
if (a OR 1) = 0 then bit0_notset else bit0_set
if (a OR 2) = 0 then bit1_notset else bit1_set
if (a OR 4) = 0 ...
Briga
|
|
|
|
|
Briga
Thanks so much! It's so simple, yet it is not discussed in any of the VB.Net books I have.
OR didn't work for me, but AND did.
Thanks again
Thanks,
Karen
Nooobie to OOP and VB.Net 2005
|
|
|
|
|
Sorry ... of course you're right is AND not OR!!!!
|
|
|
|
|
Sorry, of course you're right it's AND not OR (my mistake)!!!
|
|
|
|
|
Is there a way to control the sndrec32? I would like to be able to have it load a .wav, play it, save it as a .wav with different sample rate, etc..
any help would be appreciated.
|
|
|
|
|
Does anyone know the VB equivalent of going to the Mouse Properties in the Control Panel, changing the mouse schema, and saving/naming that schema?
i'd like to write a simple program that changes the mouse schema to one i made, and i got the setup to move the cursors to the right place, but i don't have any clue as to how to change things like this within windows from VB.NET
thanks for any help,
stephen
|
|
|
|
|
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
|
|
|
|