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
G

Gagan 20

@Gagan 20
About
Posts
165
Topics
75
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Creating Multi-user db application
    G Gagan 20

    Hi all... I am going to make a multi-user database application in VB.NET (VS 2008). I have made several db program using different databases and made some client-server based chat programs. But I never worked on multi-user db program. I wanna know that which database should I use as back-end. Application will be accessible by 3-5 users. I also wanna know that from where to start to build multi-user program. Suggest me. Thanks.

    Gagan

    Visual Basic database csharp visual-studio sysadmin

  • process not starting on x64 bit OS
    G Gagan 20

    Hi all... I have made a program in VB.NET(VS 2008) to start a cmd.exe process using Process class. Code is running perfectly on 32-bit Windows but when I am trying to run same code on 64-bit Windows 7 it is giving an error message that process file not found. I compiled code for ANY CPU, x32 and x64 and tested separately on 64-bit OS but getting same error message. Suggest me what should I do. Thanks.

    Gagan

    Visual Basic csharp visual-studio help

  • Process creation error in Win 7
    G Gagan 20

    Thanks Luc for your help. :) I compiled and run my code on 32-bit successfully. But if I want to run this code on 64-bit then what should I do? Thanks.

    Gagan

    Visual Basic csharp visual-studio help

  • Process creation error in Win 7
    G Gagan 20

    I am passing cmd.exe as process name and working directory as c:\Windows\System32\ The error message is : System.ComponentModel.Win32Exception: The system cannot find the file specified at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) All the necessary files are present and same code is working in Win XP but not in Win 7. What to do to make this code running on Win 7? Thanks.

    Gagan

    Visual Basic csharp visual-studio help

  • Process creation error in Win 7
    G Gagan 20

    Hi all... I wrote an application in VB.NET (VS 2008) to start a process and read its output error. The code is given below :

    Private Function getProcessOutput(ByVal processName As String, ByVal args As String, ByVal processPath As String)
    Dim output As String = ""
    Try
    Dim prc As Process = New Process 'Create object of Process.
    Dim prcInfo As New ProcessStartInfo 'Create object of ProcessStartInfo
    With prcInfo 'Set attributes to ProcessStartInfo object.
    .FileName = processName 'processname to start
    .Arguments = args 'filename is passed as argument
    .CreateNoWindow = True 'Make background process
    .UseShellExecute = False 'Set to false to redirect output/error.
    .RedirectStandardOutput = True 'Enable output redirection
    .RedirectStandardError = True 'Enable error redirection
    .WorkingDirectory = processPath 'working directory where process file is stored.
    End With
    prc.StartInfo = prcInfo
    prc.Start()

                    prc.BeginOutputReadLine()   'Start reading output in asynchronous way.
                    output = prc.StandardError.ReadToEnd()  'Read whole error.
                    prc.WaitForExit()   'wait for process to exit.
      Catch ex as Exception
            Msgbox(ex.message)
      End Try
    
        Return output       'Return output whether it is error or program output.
    End Function
    

    This function is working pretty well in Windows XP but when I am trying to run this code in Win 7, it throws an exception that file not found. I checked process name and working directory for the file which I want to run but still it is generating same error message. Suggest me what should I do. Thanks.

    Gagan

    Visual Basic csharp visual-studio help

  • Error while retrieving records between two dates
    G Gagan 20

    Thanks for your help. My problem has been solved. :)

    Gagan

    Visual Basic database algorithms help

  • Error while retrieving records between two dates
    G Gagan 20

    I solved my problem. The problem was that Current_Date is reserved keyword in current Access table and I didn't wrote it in []. Now I wrote following code and It worked.

    cmd.Parameters.AddWithValue("[Current_Date]", Date.Parse(txtDateFrom.Text))
    cmd.Parameters.AddWithValue("[Current_Date]", Date.Parse(txtDateTo.Text))

    BTW thanks for your help. :)

    Gagan

    Visual Basic database algorithms help

  • Error while retrieving records between two dates
    G Gagan 20

    Thanks Dave for your quick reply. I used parameterised query to search record but still I'm getting same error

    Try
    me.listView1.Items.Clear()
    Dim resultFound As Integer
    DBConnection.connect()
    Dim sql As String = "select * from MortgageDetails where Current_Date >= ? and Current_Date <= ?"
    Dim cmd As New OleDbCommand(sql, con)
    cmd.Parameters.AddWithValue("Current_Date", Convert.ToDateTime(txtDateFrom.Text))
    cmd.Parameters.AddWithValue("Current_Date", Convert.ToDateTime(txtDateTo.Text))

            Dim reader As OleDbDataReader = cmd.ExecuteReader
            While reader.Read
                Dim item As New ListViewItem(New String() {reader.GetInt32(0), reader.GetString(1), reader.GetString(2), \_
                                                          reader.GetString(3), reader.GetString(4), reader.GetString(5), \_
                                                          reader.GetDateTime(6), reader.GetInt32(7), reader.GetInt32(8)})
                me.listView1.Items.Add(item)
                resultFound += 1
            End While
            reader.Close()
            lblStatus.Text = resultFound & " record(s) found!"
            'Me.Close()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    

    Don't know what is wrong. :(

    Gagan

    Visual Basic database algorithms help

  • Error while retrieving records between two dates
    G Gagan 20

    Hi all... I am getting an error while searching records between two dates. The error message is "IErrorInfo.GetDescription failed with E_FAIL(0x80004005)." code is :

    Try
    Me.listView1.Items.Clear()
    Dim resultFound As Integer
    DBConnection.connect() 'Code to open database.
    Dim sql As String = "select * from MortgageDetails where Current_Date between '" & Convert.ToDateTime(txtDateFrom.Text) & "' and '" & Convert.ToDateTime(txtDateTo.Text) & "'"
    Dim cmd As New OleDbCommand(sql, con)
    Dim reader As OleDbDataReader = cmd.ExecuteReader 'Getting error on this line.
    While reader.Read
    Dim item As New ListViewItem(New String() {reader.GetInt32(0), reader.GetString(1), reader.GetString(2), _
    reader.GetString(3), reader.GetString(4), reader.GetString(5), _
    reader.GetDateTime(6), reader.GetInt32(7), reader.GetInt32(8)})
    Me.listView1.Items.Add(item)
    resultFound += 1
    End While
    reader.Close()
    lblStatus.Text = resultFound & " record(s) found!"
    'Me.Close()
    Catch ex As Exception
    MsgBox(ex.Message)
    End Try

    Suggest me what should I do Thanks. Gagan

    Visual Basic database algorithms help

  • Update Query Error
    G Gagan 20

    Thanks for your answer. It worked.

    Visual Basic database help announcement

  • Update Query Error
    G Gagan 20

    Hi all... When I execute update query, I get error "data type mismatch in criteria expression" I used following code :

    Try
    DBConnection.connect() 'code to open database.
    Dim sql As String = "update MortgageDetails set [Borrower_Name]='" & txtBorrowerName.Text & "', [Caste]='" & txtCaste.Text & "', " & _
    "[Area]='" & txtArea.Text & "', [Address]='" & txtAddress.Text & "', [Product_Detail]='" & txtProductDetail.Text & "', " & _
    "[Current_Date]='" & txtCurrentDate.Text & "',[Current_Value]=" & txtProductValue.Text & "," & _
    "[Amount_Borrowed]=" & txtAmountBorrowed.Text & " where [S_No]=" & txtSNo.Text

            Dim cmd As New OleDbCommand(sql, con)
            cmd.ExecuteNonQuery()
            MsgBox("Record Updated!", MsgBoxStyle.Information)
            Me.Close()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    

    I am using VB2008 and MS Access 2003 as database. Suggest me what to do. Thanks. Gagan

    Visual Basic database help announcement

  • SHFormatDrive error
    G Gagan 20

    I have a VBScript that uses WMI to format a drive. I got the code from some site but it is not formatting my pen drvie and giving error while executing the script. The code is below:

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    Set colVolumes = objWMIService.ExecQuery _
    ("Select * from Win32_Volume Where Name = 'G:\\'")

    For Each objVolume in colVolumes
    errResult = objVolume.Format("NTFS")
    Next

    Here G: is my pen drive's drive name. Suggest me how to format my pen drive. Thanks. Gagan

    Visual Basic database data-structures regex json help

  • SHFormatDrive error
    G Gagan 20

    The WMI method you suggest to format drive is good but I've still some doubt. In this WMI method I do not understand that what drive it will format or what should I do to format a perticular drive. Suggest me what should I do. Thanks. Gagan

    Visual Basic database data-structures regex json help

  • SHFormatDrive error
    G Gagan 20

    When I am using the below code, it appears a Windows format window to format the drive.

    _
    Private Shared Function SHFormatDrive(ByVal hwnd As IntPtr, ByVal drive As UInteger, ByVal fmtID As UInteger, ByVal options As UInteger) As UInteger
    End Function

    Public Enum SHFormatFlags As Integer
        SHFMT\_ID\_DEFAULT = &HFFFF
        SHFMT\_OPT\_FULL = &H1
        SHFMT\_OPT\_SYSONLY = &H2
        SHFMT\_ERROR = &HFFFFFFFF
        SHFMT\_CANCEL = &HFFFFFFFE
        SHFMT\_NOFORMAT = &HFFFFFFD
    End Enum
    

    Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click

    Dim ret = SHFormatDrive(Me.Handle.ToInt64, _
    drvToFormat, _
    CUInt(SHFormatFlags.SHFMT_ID_DEFAULT), _
    0)
    msgbox(ret.tostring)
    End Sub

    It appears Windows format option to format the drive but I want that when I click on start button, it start formatting rather than displaying another window to format drive. Tell me what should I do. Thanks. Gagan

    Visual Basic database data-structures regex json help

  • SHFormatDrive error
    G Gagan 20

    I tried Me.Handle.ToInt64 as it returns a long value but I still have the same error.

    Visual Basic database data-structures regex json help

  • SHFormatDrive error
    G Gagan 20

    daveauld wrote:

    My.Computer.FileSystem.Drives(x).DriveFormat()

    Don't you know what it does? It only tells the drive format as FAT or NTFS and does not format the drive. I want to format my pen drive not to get its drive format name. Gagan

    Visual Basic database data-structures regex json help

  • SHFormatDrive error
    G Gagan 20

    Hi all... I am trying to format my pen drive by calling API SHFormatDrive function but it gives an error message. I am using the following lines of code :

    Private Declare Function SHFormatDrive Lib "shell32" (ByVal hwnd As Long, ByVal iDrive As Long, ByVal iCapacity As Long, ByVal iFormatType As Long) As Long
    Const SHFD_CAPACITY_DEFAULT = 0 'default drive capacity
    Const SHFD_FORMAT_QUICK = 0 'Quick format.
    Const SHFD_FORMAT_FULL = 1 'Full format.

    Private Sub btnStart\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
    
             Try
       
                Dim drvToFormat As Long = 6 '6 is the index of pendrive for G: drive.
                Dim ret As Long
    
                If chkQuickFormat.Checked Then 'Check for quick format.
                    ret = SHFormatDrive(Me.Handle.ToInt32, \_
                    drvToFormat, \_
                    SHFD\_CAPACITY\_DEFAULT, \_
                    SHFD\_FORMAT\_QUICK)
                Else
                    ret = SHFormatDrive(Me.Handle.ToInt32, \_
                    drvToFormat, \_
                    SHFD\_CAPACITY\_DEFAULT, \_
                    SHFD\_FORMAT\_FULL)
                End If
    
                Select Case ret
                    Case -1
                        MsgBox("Error during format operation")
                    Case -2
                        MsgBox("Operation canceled by user")
                    Case -3
                        MsgBox("This drive cannot be formatted")
                    Case Else
                        MsgBox("Done")
                End Select
            Catch ex As Exception
         
                MsgBox(ex.Message)
            End Try
        End If
    End Sub
    

    The above code is giving an error that "A call to PInvoke function 'SHFormatDrive' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature." I don't know exactly what is going wrong and when I am trying to format my pen drive, the above code is first checking for A: drive and then it is giving error. Suggest me what should I do. Thanks. Gagan

    Visual Basic database data-structures regex json help

  • Error while executing cmd command through vb.net
    G Gagan 20

    I have a doubt in the example you had suggested. I am using a combo box to select drive name. In the code

    Call SHFormatDrive(Me.hWnd, _
    drvToFormat, _
    SHFD_CAPACITY_DEFAULT, _
    SHFD_FORMAT_QUICK)

    where drvToFormat is declared as integer. When I am passing drive name to drvToFormat it is giving error that conversion from string to integer is not valid. What value should I paas as to drvToFormat to format my pen drive? Thanks. Gagan

    Visual Basic csharp help

  • Thread slow down system
    G Gagan 20

    Dave Kreskowiak wrote:

    Your have two "fixes" for the performance problem. First, switch your loops so your only getting the Process list once per pass.

    I created a list of all running processes and stored it in ProcessList. Now I am comparing the executable file stored in MonitorList with process name stored in Process List.

    Dave Kreskowiak wrote:

    Second, put in a Thread.Sleep (with an appropriate value) to put this thread to sleep for a second or two before it goes for another pass.

    I put this thread to sleep for 1 second as memThd.sleep(1000) after one iteration. But it does not speeds up my system. Suggest me some other ways. Thanks. Gagan

    Visual Basic performance

  • Thread slow down system
    G Gagan 20

    Paulo Zemek wrote:

    I must say that if drive is A your code will not work

    I have already checked if drv.DriveName<>"A:" then starting the thread.

    Paulo Zemek wrote:

    You can try to set the thread priority to Idle...

    I set the prority of threat to 0 (i.e. lowest priority) but it has no effect. Suggest me some other ways. Thanks. Gagan

    Visual Basic performance
  • Login

  • Don't have an account? Register

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