Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

johnjsm

@johnjsm
About
Posts
90
Topics
51
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • vbscript
    J johnjsm

    Hi Can some one help. I'm trying to run the following script but nothing happens

    Option Explicit
    Public objShell
    dim in = "C:\test3.pdf"
    dim out = "C:\test4.ps"
    set input = in
    set output = out
    Set objShell = WScript.CreateObject ("WScript.shell")
    objShell.run "c:\pdftops.exe -nocrop -noshrink -level3 %input% %output% "

    Visual Basic linux tools help

  • Adding progress bar for CRC32 checksum
    J johnjsm

    Cool. Thanks guys for the help

    Visual Basic question

  • Adding progress bar for CRC32 checksum
    J johnjsm

    Thank you for your answer but how do I know how many bytes are processed

    Visual Basic question

  • Adding progress bar for CRC32 checksum
    J johnjsm

    Hi, I have a public function that generates a CRC32 checksum of a file. What I am looking to add to it is a progress bar that progresses as the checksum is created. CRC32 Function

    Public Function GetCrc32(ByRef stream As System.IO.Stream) As Integer

        Dim crc32Result As Integer
        crc32Result = &HFFFFFFFF
    
        Dim buffer(BUFFER\_SIZE) As Byte
        Dim readSize As Integer = BUFFER\_SIZE
    
        Dim count As Integer = stream.Read(buffer, 0, readSize)
        Dim i As Integer
        Dim iLookup As Integer
        Dim tot As Integer = 0
        Do While (count > 0)
            For i = 0 To count - 1
                iLookup = (crc32Result And &HFF) Xor buffer(i)
                crc32Result = ((crc32Result And &HFFFFFF00) \\ &H100) And &HFFFFFF   ' nasty shr 8 with vb :/
                crc32Result = crc32Result Xor crc32Table(iLookup)
            Next i
            count = stream.Read(buffer, 0, readSize)
        Loop
    
        GetCrc32 = Not (crc32Result)
    
    End Function
    

    the function is then called when I click on a button

    Dim f As FileStream = New FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
    crc = c32.GetCrc32(f)
    lblCRC32.Text = Hex(crc)

    How do I add a progress bar to work with the function and display the actual progress. Thanks J

    Visual Basic question

  • Using printdocumnet and printdialog
    J johnjsm

    Hi, I am trying to print a pdf using the printdocument and printdialog by passing a file name using the opendialog. This is my code im c1 As OpenFileDialog = New OpenFileDialog c1.InitialDirectory = "c:\" c1.Filter = "PDF Files (*.pdf)|*.pdf" If (c1.ShowDialog() = DialogResult.OK) Then lblFileName.Text = c1.FileName file = lblFileName.Text End If PrintDocument1.DocumentName = file PrintDialog1.ShowDialog() PrintDocument1.Print() Anytime I try this it does not print anything. Can anyone help please

    Visual Basic help

  • Help using IMAPI2
    J johnjsm

    Hi, I am having awful trouble trying to use the IMAPI2. All I am trying to do is do display the media in a drive per drive letter and also trying to read an ISO. If anyone can help it would be great. Thanks

    Visual Basic help

  • Start program by dragging file onto exe
    J johnjsm

    I will try explain what I am trying to do a little better than before. I have a program that when you run it the Open FIle Dialog appears so you can select a pdf to run a check on. What I want to do is to allow the user to drag and drop the pdf onto the exe an instead of opening the Open File dialog it would bypass it but still use the file name and path that I have selected as the file to check. An example of this would be if you create a text file on your desktop. You can then drag and drop the file on Notepad.exe and the file will open straight away.

    modified on Thursday, July 3, 2008 10:46 AM

    Visual Basic

  • running DOS exe using Process.Start
    J johnjsm

    Excellent. Thanks Dave.

    Visual Basic

  • running DOS exe using Process.Start
    J johnjsm

    Perfect. Thanks a million for your help.

    Visual Basic

  • running DOS exe using Process.Start
    J johnjsm

    is there a way to convert the path from the standard to the dos path version within vb.net

    Visual Basic

  • running DOS exe using Process.Start
    J johnjsm

    This is the code I am using

    'myProcess.StartInfo.FileName = "C:\Program Files\PDFcheck\pdffonts.exe " 'Full pathname to including file name
    'myProcess.StartInfo.Arguments = filename ' If the program takes args as string
    'myProcess.StartInfo.CreateNoWindow = True ' Does not create a window DOS program
    'myProcess.StartInfo.UseShellExecute = False ' Must be false to redirect output
    'myProcess.StartInfo.RedirectStandardOutput = True
    'myProcess.Start() ' Start the DOS program
    'myProcess.WaitForExit() ' Wait until it completes before moving on
    'prgOutput = myProcess.StandardOutput.ReadToEnd ' Get the DOS output
    'pdffonts = prgOutput
    'f.Close()

    Visual Basic

  • running DOS exe using Process.Start
    J johnjsm

    Hi, When I run a DOS command line program it will work on a file that is located in the root of C:\ but if I try to run it on a file on my desktop nothing happens. Is there any way to get this to work.

    Visual Basic

  • Start program by dragging file onto exe
    J johnjsm

    Hi, Is it possible or how do you create a exe that when you drop a file onto it, the program will run and do a task on the file that your dragged onto it.

    Visual Basic

  • Opening database connection
    J johnjsm

    Hi, I have the following code which I converted fro c#. Any time I run it I get an error at the con.open() This is the error An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll Additional information: System error. Here is the code Private Sub LookupDB(ByVal PartNum As String) Dim ConnectString As String = "user id=****;password=****;initial catalog=eLibrarian;data source=" & "*******" Dim con As SqlConnection = New SqlConnection(ConnectString) Dim cmd As SqlCommand = New SqlCommand("pGetSWEETFileAttributes", con) cmd.CommandType = CommandType.StoredProcedure ' ' Initialise parameters to database stored procedure: ' ' 1. Input Parameter representing Part Number ' Dim param As SqlParameter = New SqlParameter("@inparam_ElementID", SqlDbType.VarChar, 50) param.Direction = ParameterDirection.Input param.Value = PartNum cmd.Parameters.Add(param) ' ' Read from database ' con.Open() Dim reader As SqlDataReader = cmd.ExecuteReader() 'ExecuteNonQuery(); Dim record_count As Integer = 0 While reader.Read() txtSize.Text = reader("FileSize").ToString() txtMD5.Text = reader("MD5Checksum").ToString() record_count = record_count + 1 End While reader.Close() con.Close() If record_count = 0 Then Throw New Exception("Part number " + PartNum + " not found in dataMyBase. Please enter the filesize and MD5 checksum") End If End Sub

    Visual Basic database csharp help

  • adding progress bar
    J johnjsm

    Hi Dave, This is the code used for generating the CRC32 Public Class CRC32 ' This is v2 of the VB CRC32 algorithm provided by Paul ' (wpsjr1@succeed.net) - much quicker than the nasty ' original version I posted. Excellent work! Private crc32Table() As Integer Private Const BUFFER_SIZE As Integer = 1024 Public Function GetCrc32(ByRef stream As System.IO.Stream) As Integer Dim crc32Result As Integer crc32Result = &HFFFFFFFF Dim buffer(BUFFER_SIZE) As Byte Dim readSize As Integer = BUFFER_SIZE Dim count As Integer = stream.Read(buffer, 0, readSize) Dim i As Integer Dim iLookup As Integer Dim tot As Integer = 0 Do While (count > 0) For i = 0 To count - 1 iLookup = (crc32Result And &HFF) Xor buffer(i) crc32Result = ((crc32Result And &HFFFFFF00) \ &H100) And &HFFFFFF ' nasty shr 8 with vb :/ crc32Result = crc32Result Xor crc32Table(iLookup) Next i count = stream.Read(buffer, 0, readSize) Loop GetCrc32 = Not (crc32Result) End Function Public Sub New() ' This is the official polynomial used by CRC32 in PKZip. ' Often the polynomial is shown reversed (04C11DB7). Dim dwPolynomial As Integer = &HEDB88320 Dim i As Integer, j As Integer ReDim crc32Table(256) Dim dwCrc As Integer For i = 0 To 255 dwCrc = i For j = 8 To 1 Step -1 If (dwCrc And 1) Then dwCrc = ((dwCrc And &HFFFFFFFE) \ 2&) And &H7FFFFFFF dwCrc = dwCrc Xor dwPolynomial Else dwCrc = ((dwCrc And &HFFFFFFFE) \ 2&) And &H7FFFFFFF End If Next j crc32Table(i) = dwCrc Next i End Sub End Class Public Class GetCRC32OF Public Sub CRC32File() End Sub End Class

    Visual Basic help

  • adding progress bar
    J johnjsm

    Hi, I need to add a progress bar that will progress with the amount of bytes read of a file. I am performing a CRC32 on a large file and I would like to display the progress using the progress bar and also text displaying the percentage done. The crc32 is already running on a seperate thread. Can anyone help. This is the code for getting the crc32 Dim f As FileStream = New FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 8192) crc = c32.GetCrc32(f) lblCRC32V.Text = Hex(crc) f.Close() Thanks

    Visual Basic help

  • remaining free space on HD
    J johnjsm

    Try this. In this example you will need one button and 3 textboxes.Hope this helps Declareations Inherits System.Windows.Forms.Form Private Declare Function GetDiskFreeSpaceEx _ Lib "kernel32" _ Alias "GetDiskFreeSpaceExA" _ (ByVal lpDirectoryName As String, _ ByRef lpFreeBytesAvailableToCaller As Long, _ ByRef lpTotalNumberOfBytes As Long, _ ByRef lpTotalNumberOfFreeBytes As Long) As Long Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = GetFreeSpace("C:\") TextBox2.Text = GetTotalSpace("C:\") GetPercentageFree() If TextBox3.Text < 36 Then MsgBox("You are running out of space") End If End Sub Public Function GetFreeSpace(ByVal Drive As String) As Long 'returns free space in MB, formatted to two decimal places 'e.g., msgbox("Free Space on C: "& GetFreeSpace("C:\") & "MB") Dim lBytesTotal, lFreeBytes, lFreeBytesAvailable As Long Dim iAns As Long iAns = GetDiskFreeSpaceEx(Drive, lFreeBytesAvailable, _ lBytesTotal, lFreeBytes) If ians > 0 Then Return BytesToMegabytes(lFreeBytes) Else Throw New Exception("Invalid or unreadable drive") End If End Function Public Function GetTotalSpace(ByVal Drive As String) As String 'returns total space in MB, formatted to two decimal places 'e.g., msgbox("Free Space on C: "& GetTotalSpace("C:\") & "MB") Dim lBytesTotal, lFreeBytes, lFreeBytesAvailable As Long Dim iAns As Long iAns = GetDiskFreeSpaceEx(Drive, lFreeBytesAvailable, _ lBytesTotal, lFreeBytes) If iAns > 0 Then Return BytesToMegabytes(lBytesTotal) Else Throw New Exception("Invalid or unreadable drive") End If End Function Private Function BytesToMegabytes(ByVal Bytes As Long) _ As Long Dim dblAns As Double dblAns = (Bytes / 1024) / 1024 BytesToMegabytes = Format(dblAns, "###,###,##0.00") End Function Public Function GetPercentageFree() Dim free As Integer Dim total As Integer Dim percent As Integer free = GetFreeSpace("C:\") total = GetTotalSpace("C:\") percent = (free / total) * 100 TextBox3.Text = percent End Function

    Visual Basic question tutorial

  • Printing windows form
    J johnjsm

    Hi, Will this work with VB.net 2003. also I can't find the component. Can you help. Thanks

    Visual Basic csharp

  • Printing windows form
    J johnjsm

    Hi, I have a windows form and I want to print the contents of it. Is it possible to do this in vb.net

    Visual Basic csharp

  • Getting DOS output
    J johnjsm

    I did what you suggested and it works. Thnaks for your help.

    Visual Basic help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups