|
Hi Dave,
This is the code used for generating the CRC32
Public Class CRC32<br />
<br />
' This is v2 of the VB CRC32 algorithm provided by Paul<br />
<br />
' (wpsjr1@succeed.net) - much quicker than the nasty<br />
<br />
' original version I posted. Excellent work!<br />
<br />
Private crc32Table() As Integer<br />
<br />
Private Const BUFFER_SIZE As Integer = 1024<br />
<br />
Public Function GetCrc32(ByRef stream As System.IO.Stream) As Integer<br />
<br />
Dim crc32Result As Integer<br />
<br />
crc32Result = &HFFFFFFFF<br />
<br />
Dim buffer(BUFFER_SIZE) As Byte<br />
<br />
Dim readSize As Integer = BUFFER_SIZE<br />
<br />
Dim count As Integer = stream.Read(buffer, 0, readSize)<br />
<br />
Dim i As Integer<br />
<br />
Dim iLookup As Integer<br />
<br />
Dim tot As Integer = 0<br />
<br />
Do While (count > 0)<br />
<br />
For i = 0 To count - 1<br />
<br />
iLookup = (crc32Result And &HFF) Xor buffer(i)<br />
<br />
crc32Result = ((crc32Result And &HFFFFFF00) \ &H100) And &HFFFFFF ' nasty shr 8 with vb :/<br />
<br />
crc32Result = crc32Result Xor crc32Table(iLookup)<br />
<br />
Next i<br />
<br />
count = stream.Read(buffer, 0, readSize)<br />
<br />
Loop<br />
<br />
GetCrc32 = Not (crc32Result)<br />
<br />
End Function<br />
<br />
Public Sub New()<br />
<br />
' This is the official polynomial used by CRC32 in PKZip.<br />
<br />
' Often the polynomial is shown reversed (04C11DB7).<br />
<br />
Dim dwPolynomial As Integer = &HEDB88320<br />
<br />
Dim i As Integer, j As Integer<br />
<br />
ReDim crc32Table(256)<br />
<br />
Dim dwCrc As Integer<br />
<br />
For i = 0 To 255<br />
<br />
dwCrc = i<br />
<br />
For j = 8 To 1 Step -1<br />
<br />
If (dwCrc And 1) Then<br />
<br />
dwCrc = ((dwCrc And &HFFFFFFFE) \ 2&) And &H7FFFFFFF<br />
<br />
dwCrc = dwCrc Xor dwPolynomial<br />
<br />
Else<br />
<br />
dwCrc = ((dwCrc And &HFFFFFFFE) \ 2&) And &H7FFFFFFF<br />
<br />
End If<br />
<br />
Next j<br />
<br />
crc32Table(i) = dwCrc<br />
<br />
Next i<br />
<br />
End Sub<br />
<br />
End Class<br />
<br />
Public Class GetCRC32OF<br />
<br />
Public Sub CRC32File()<br />
<br />
End Sub<br />
<br />
End Class
|
|
|
|
|
OK. So add a little code to the main processing loop to fire an event every so often reporting the percentage complete.
You consumer code should create an instance of this class, wireup the event you write and use the data from that event to update the progress bar.
|
|
|
|
|
Newbie here, "Hello" forum.
As the title suggests I'm looking to use the GPS Intermediate Driver parsed API through VB. I'm not a C programmer so this would be a great solution for us VBers...
The API appears to have just 4 functions and eliminates having to directly code to the com port, perfect. (http://msdn2.microsoft.com/en-us/library/bb202033.aspx)
GPSOpenDevice
GPSGetPosition
GPSGetDeviceState
GPSCloseDevice
I'm not familiar enough with how to implement the API to be able to get off the ground, I'm hoping somebody might be able to help out.
Thanks.
TW,
|
|
|
|
|
VB.NET examples using this library are a bit difficult to come by.
I did find the PInvoke signatures of a couple of those functions here[^]. You can figure out the other two using the documentation on the functions are the URL you posted.
|
|
|
|
|
i have got a Strange problem about msinet.ocx while using getheader method.
it is:
i write this code
Private Sub Inet1_StateChanged(ByVal State As Integer)<br />
Select Case State<br />
Case 8<br />
If app_status = 1 Then<br />
'xnei_header = Inet1.GetHeader<br />
Text3.Text = Text3.Text & vbCrLf & "error: " & vbCrLf & xnei_header<br />
app_status = 2<br />
Else<br />
xnei_header = Inet1.GetHeader<br />
Text3.Text = Text3.Text & vbCrLf & "error: " & vbCrLf & xnei_header<br />
End If<br />
If app_status = 3 Then<br />
Text6.Text = Text6.Text & vbCrLf & "error: " & vbCrLf & xnei_header<br />
app_status = 4<br />
End If<br />
Case 12<br />
If app_status = 2 Then<br />
Text3.Text = Text3.Text & ResponseInfo & vbCrLf & vbCrLf & Inet1.GetHeader<br />
End If<br />
If app_status = 4 Then<br />
Text6.Text = Text6.Text & ResponseInfo & vbCrLf & vbCrLf & Inet1.GetHeader<br />
End If<br />
End Select<br />
End Sub
the code write for auto_login to a website
when i post the correct user/pwd data to the site,it will return a http
header with values=302 and if the user/pwd wrong,it will be 200
then inet1 will go on fetching the site
i found i can use getheader method to see if the return value is 302 or 200 while state change to 8
and these code work normally at my home PC(it use a adsl net)
but can not work at my school PC(it use a lan net and after a route)
the vbide show error like this:
RUNTIME ERROR : "35756"
Unable to complete request!
it seems a error accur at xnei_header = Inet1.GetHeader
some people told it is because my pc is after a route
isn't it?
if it is ,please tell me how to solve it, thx
|
|
|
|
|
It probably has something to do with a proxy or firewall server in your schools network. You'll have to examine the returned page data from the proxy in order to figure this one out. It's possible you're not even getting to the page at all because it may be blocked by the proxy.
|
|
|
|
|
yes.all the data will be send by the router,it's ip is 192.168.0.1
but i think other people's gateway might be anyother like 192.168.1.1
so if there some method to get the gateway's ip???
|
|
|
|
|
You don't need it. The TCP/IP configuration is usually setup with the proper gateway address already. The gateway has nothing to do with a proxy anyway. That's seperate, but on smaller broadband routers for the home, a proxy/NAT/firewall is usually found on the same device at the same address.
If Internet Explorer works for outside sites, you don't have to worry about setting up proxy settings. The Inet control uses the proxy settings in IE automatically.
|
|
|
|
|
but how to solve the problem whitch i have meet
|
|
|
|
|
I already told you, you're going to have to examine the page headers and content returned from the page request so you can figure out where the difference is when you request the page via the proxy compared to when you aren't forced to use a proxy.
|
|
|
|
|
ok,i'll get a try,i'am sorry my english is poor
|
|
|
|
|
Hello,
Does anyone know how to enable paging on a datagrid using adodc connection? So far I have almost 1000 records that needs to be displayed. This query dsplays via scroll bar. I'd like divide these records by page. Thanks in advance!
Sorry I forgot to mention I'm doing a windows application not web. I've weird thing is AllowPaging is not available in datagrid option or in any other options. Any help would be much appreciated. Thanks again!
Aim small, miss small
|
|
|
|
|
As far as I can remember, there is no paging "option" on the old grids. You had to implement it yourself providing code and SQL to grab the next/previous page from the database and bind to that.
|
|
|
|
|
Ahh...that explains why I can't find that darn paging option. So it has to be done the long way...Many thanks friend!
Aim small, miss small
|
|
|
|
|
Hi,
I'm doing a vb.net (Window Application) project.
I'm retrieving data to a datagrid. It has checkbox at the 1st column (DataGridBoolColumn).
User is able to check or uncheck the rows in datagrid.
Once user click save, how can i insert those rows where checkbox is selected into SQL table?
I found few samples but those are for asp.net.
Can anyone advice me as i'm using window application.
Thanks in advanced.
cheers,eunice
|
|
|
|
|
Hello Euince,
You would have to manually insert the rows into SQL table by looping through the rows and check if
the first column is checked or not.
Regards,
Allen
Allen Smith
Software Engineer
ComponentOne LLC
www.componentone.com
|
|
|
|
|
Hi Allen,
Thanks for the tips. But how can i loop through?
Is it something like this?
For i = 0 To icounter - 1
If myTable.Rows(0).Item("check") = True Then
Dim RawID As Object = dgResult.Item(i, 2)
Dim Question As Object = dgResult.Item(i, 3)
strQuery = "Insert into udtInsert (RawID,Question) values(" & RawID.ToString() & ",'" & Question.ToString() & "' )"
conn.Open()
cmd.CommandText = strQuery
cmd.Connection = conn
End If
Next
pls advice... thanks a lot.
cheers,eunice
|
|
|
|
|
Hi,
i have designed a new control with some propertys. Some of the propertys should only at runtime be available, not at designtime.
Codesample:
<system.componentmodel.designtimevisibleattribute(false)> _
Public Property MyProperty As Boolean
Get
......
This doesn't work.
But
<system.componentmodel.designonly(true)> _
Public Property MyProperty As Boolean
Get
......
works fine, property is only avialable at designtime, not at runtime.
Something like RuntimeOnly is missing ?!
Any comments ?
bauer
|
|
|
|
|
You didn't check the "Ignore HTML tags in this message" box at the bottom of your post before you hit "Post Message", so some of your code is missing from your post.
But, hiding a public property from the PropertyGrid (Designer) is easy. All you have to do is specify the Browsable attribute on your property.
<Browsable(False)> _
Public Property MyProperty() As Integer
...
End Property
|
|
|
|
|
Dave,
your
<Browsable(False)> _
Public Property MyProperty() As Integer
... End Property
prevents the property to be accessed with the property window. But the designer still generates code to set the property.
Okay, i can code <DesignerSerializationVisibility ....>, so no code setting the property is generated.
But placing the control on any form executes the Get Method of the Property.
How to create a Property which is only avialable at runtime and excutes only at runtime ???
Something like the opposite of <System.ComponentModel.DesignOnly(True)> seems to be missing.
regards
bauer
|
|
|
|
|
In the property code, check the DesignMode property to see if it's being used in the designer. There are pitfalls to doing this, though. The DesignMode property isn't known for its reliability.
Public Property SomeProperty As Integer
Get
If Me.DesignMode Then
' The control is being used on a design surface...
Else
' The control is NOT being used a design surface...
End If
End Get
...
End Property
|
|
|
|
|
Dave,
thank you very much, for your quick reply.
I think, this coding (Process.GetCurrentProcess.ProcessName = "devenv") isnn't much better ?!
regards,
bauer
|
|
|
|
|
iam using select case statement .in this iwant to work with two select statements by which one select statement works on the user eneterd value and other select statement should work for every select case ..is it possible
|
|
|
|
|
Like another control statement the case statement could also be nested but nested will give the complex code to you so i suggest you to call function so on select statement you could call the function according to the values entered by user.
With Regards
Yogesh Agarwal
|
|
|
|
|
Hi All
i have a grid control (Sheridan Grid) in my visual basic 6 application this grid has his first row as a checkbox column,
Now the problem is
I want to call a function when user check or uncheck the column but i unable to do the same i tried the aftercolupdate event but it will show the runtime error and my application will close after that error. The calculation goes fine but the problem is that run time error.
The error is :-
"Visual Basic has encountered a problem and needs to close. We are sorry for the inconvenience"
Then it display the message for sending the problem to microsoft with send and din't send button
plz help in resolving the problem ...
With Regards
Yogesh Agarwal
|
|
|
|