Netcode 33 Veteran Poster

Pls everyone, i need help with two regula expressions

One to accept only file word and pdf file and the other to accept only images(.jg|.bmp|.png|.gif)
Thanks

Netcode 33 Veteran Poster

I have two FileUpload Controls. I want one of them to accept only word and pdf file, the other is to accept only images(.jpg|.bmp|.gif|.png).
I've actually tried coding an upload button and i tworked but i prefer a client-side validation so i've decided to use a RegularExpressionValidator.

Pls I need a regular expression for the two controls as earlier stated.

Thanks

Netcode 33 Veteran Poster

adatapost, thanks a lot but am sure you meant:

if (fileUpload1.PostedFile.ContentType==""image/JPEG") Then 
'
'
'
End If
Netcode 33 Veteran Poster

You have to specify file size so the user does not try to ulpoad a file larger than what the file-Upload control can handle. Besides, it helps in memory management of your server

Netcode 33 Veteran Poster

i have a file upload control. Please how do i specify a file size and file tyoe to be uploaded. Its very urgent

Netcode 33 Veteran Poster

pls mark thread as solved if solved

Netcode 33 Veteran Poster

How do I create a Dynamic crystal report? That is, I want my codes to select and filter the content of the datagrid at runtime. I need help seriously, Thanks

Netcode 33 Veteran Poster

you can simply set the AcceptButton property of the form to the search button

Netcode 33 Veteran Poster

pls always remember to mark thread as solved when you've finally got a solution

Netcode 33 Veteran Poster
Private Sub Textbox1_TextChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Textbox1.TextChanged

if IsNumeric(TextBox1.Text) THen 
   'do nothing 
else 
   'display error message
   messagebox.show("Numbers Only", "Error")
   'clear textbox 
TextBox1.Text = ""
End If
Netcode 33 Veteran Poster
Imports System.Math

Public Class calculator

    Dim cleardisplay As Boolean
    Dim operand1 As Double
    Dim operand2 As Double
    Dim Operator1 As String

    Private Sub Digit_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles btn1.Click, btn2.Click, _
            btn3.Click, btn4.Click, btn5.Click, btn6.Click, _
            btn7.Click, btn8.Click, btn9.Click, btn0.Click
        If cleardisplay Then
            txtDisplay.Text = ""
            cleardisplay = False
        End If
        txtDisplay.Text = txtDisplay.Text + sender.Text
    End Sub

    Private Sub btnPeriod_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPeriod.Click
        If txtDisplay.Text.IndexOf(".") > 0 Then
            Exit Sub
        Else
            txtDisplay.Text = txtDisplay.Text & "."
        End If
    End Sub

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        txtDisplay.Text = ""
    End Sub

    Private Sub btnEquals_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEquals.Click

        Dim result As Double
        operand2 = Val(txtDisplay.Text)
        Select Case Operator1
            Case "+"
                result = operand1 + operand2
            Case "-"
                result = operand1 - operand2
            Case "*"
                result = operand1 * operand2
            Case "/"
                If operand2 <> "0" Then result = operand1 / operand2
        End Select
        txtDisplay.Text = result
        cleardisplay = True
    End Sub

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        operand1 = Val(txtDisplay.Text)
        Operator1 = "+"
        cleardisplay = True
    End Sub

    Private Sub btnPrefix_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrefix.Click
        txtDisplay.Text = -Val(txtDisplay.Text)
        cleardisplay = True
    End Sub

    Private Sub btnInvers_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInverse.Click
        If Val(txtDisplay.Text) <> 0 Then txtDisplay.Text = 1 / Val(txtDisplay.Text)
        cleardisplay = True
    End Sub

    Private Sub btnTimes_Click(ByVal sender As …
Ezzaral commented: Handing someone a completed program is not helping them. -3
Netcode 33 Veteran Poster
'You can create Varbinary(Max) datatype for image column
'Below is code to store Image
Imports System.Data.SqlClient

Dim myfilelocation As String = "C:\myPictures\myimage.jpg" 
        Dim conn As New SqlConnection("Data Source= .\sqlexpress; Initial Catalog=Temp;Integrated Security =True") 
        Dim cmd As New SqlCommand("Insert Into ImageTable(ImageFile,CustomerID) Values (@ImageData,@CustomerID)", conn) 
 
        Dim param As New SqlParameter("@ImageData", SqlDbType.VarBinary) 
        Dim ImageData As Byte() = IO.File.ReadAllBytes(myfilelocation) 
        param.Value = ImageData 
        cmd.Parameters.Add(param) 
 
        cmd.Parameters.AddWithValue("@CustomerID", 3) 
        Try 
            conn.Open() 
            cmd.ExecuteNonQuery() 
        Catch ex As Exception 
            MessageBox.Show(ex.Message) 
        Finally 
            conn.Close() 
        End Try 



'And Below is the code to retrieve

Dim conn As New SqlConnection("Data Source= .\sqlexpress; Initial Catalog=Temp;Integrated Security =True") 
        Dim cmd As New SqlCommand("select ImageFile from ImageTable where CustomerID=@CustomerID ", conn) 
        cmd.Parameters.AddWithValue("@CustomerID", 3) 
        Try 
            conn.Open() 
            PictureBox1.Image = Image.FromStream(New IO.MemoryStream(CType(cmd.ExecuteScalar, Byte()))) 
         ' or you can save in a file 
  'IO.File.WriteAllBytes("c:\backup\image3.jpg", CType(cmd.ExecuteScalar, Byte()))
        Catch ex As Exception 
            MessageBox.Show(ex.Message) 
        Finally 
            conn.Close() 
        End Try
Netcode 33 Veteran Poster

I have created an application and also created the setup.The application adds it executable file to the user program menu but it does not create a shortcut on the desktop. How do i make my applications create a shourtcut menu on the desktop when they are installed

Netcode 33 Veteran Poster

If i may ask, Is it possible to update multiple rows in a database at once. if yes, how?
I have a dbase of almost 100 people. Each one has a unique reference number like this: NPHCDA/MSS/109 but i want to update the records of the hundred people and include year into their reference number so it all looks like this: NPHCDA/MSS/10/109 where '10' stands for 2010

Netcode 33 Veteran Poster

i used the report wizard and i followed the instructions. Its the code i need also to be able to select a particular set of data that meet the search string

Netcode 33 Veteran Poster

I want my application to be able to print details from the databse. I hava a report already in the program but it displays the list off all persons in the database. I want to create a form where i can use a query and the result of the query would be printed on the report.

Netcode 33 Veteran Poster

Hi everyone! I want to design a biometrics system. already, i've got it working to an extent. i can now save individual details with their images and thumbprints but i want to do a validation on the thumprints so no one person can be registered twice. thanks

Netcode 33 Veteran Poster

the NET SEND command works on windows 2000, windows me, xp but does not work on vi

kvprajapati commented: Sure :) +11
Netcode 33 Veteran Poster

you would need to create the user in sql server in order grant authentication on any data request

Netcode 33 Veteran Poster

yes, it is a web template designed with dreamweaver i think so the code is core html. I want to use this same template with the items like header, sidebar, footer. But i want to add multiple textboxes and buttons for data entry and i want to code them with asp.net/vb codes.

Netcode 33 Veteran Poster

Hi everyone, pls i need serious help. I got a free template which am editing in asp. the template just has header, footer, sidebar and others but i want to add multiple textboxes for data entry and also a submit button. pls how do i go about it because the CSS file does not include the new controls.

Netcode 33 Veteran Poster

i have downloaded and tried your project. To me, everything seems to be working fine.

Netcode 33 Veteran Poster

what database have you added to the project? there are different connection strings for different Dbase Systems

Netcode 33 Veteran Poster
If Me.txtLine2Rcon.Text = "" Then MsgBox("Please insert a running condition for Line 2 before you add it to the database", vbOKOnly)
exit sub 'this is to leave the sub procedure and prevent further code execution
Netcode 33 Veteran Poster

what are your 'Fromdate' and 'ToDate'? are they controls like textboxes indicating a date value or something else.

Netcode 33 Veteran Poster

Am using asp.net/vb. How do i make a navigation button to link another page using vb.net ans CSS.

Netcode 33 Veteran Poster

please mark thread as solved so people wont have to come back to ti

Netcode 33 Veteran Poster
If Me.txtLine2Rcon.Text = "" Then MsgBox("Please insert a running condition for Line  before you add it to the database", vbOKOnly)
exit sub
Else
 
        Dim NewLongDesc As String
        Dim RConv As String
        Dim StkCodeV As String
 
        RConv = Me.txtLine2Rcon.Text
        NewLongDesc = Me.txtLongDesc.Text
        StkCodeV = Me.txtStockCode.Text
 
        Dim con As New SqlConnection
        Dim cmd As New SqlCommand
        Try
            con.ConnectionString = "Data Source=10.10.0.25;Initial Catalog=RConditions;Persist Security Info=True;User ID=mbish;Password=mbish"
            con.Open()
            cmd.Connection = con
            cmd.CommandText = "INSERT INTO LN2(Stkcode, LongDesc,RCon) VALUES(@p1,@p2,@p3)"
            cmd.Parameters.AddWithValue("@p1", StkCodeV)
            cmd.Parameters.AddWithValue("@p2", NewLongDesc)
            cmd.Parameters.AddWithValue("@p3", RConv)
            cmd.ExecuteNonQuery()
        Catch ex As Exception
            MessageBox.Show("Error while inserting record on table..." & ex.Message, "Insert Records")
        Finally
            con.Close()
        End Try
Netcode 33 Veteran Poster

write the codes under the 'checked' procedure of both radio buttons

Netcode 33 Veteran Poster

Chuck, what Dukane is trying to explain is called 'Point Of Sale'.
it can be used in stores and other sales outlets
Nilam Padval, you need to inform the community on the project. like giving the name of the project and whats its meant to do.

Netcode 33 Veteran Poster

please lets remember to mark thread as solved so people dont keep going through the stress of looking for an already found solution. Am saying this cos am affected

Netcode 33 Veteran Poster

try the MonthCalendar or the DateTimePicker control. they may just do the work you think they cant

Netcode 33 Veteran Poster

Here is a simple code snippet for one of my apps. It searches, updates and deletes data. Maybe you can change the data and controls to suit your own app. Just take note of the 'updateMidwife' procedure which does the update function and the 'deleteMidwife' procedure which does the delete function. This is for sql-server

Imports System.Data
Imports System.Data.SqlClient

Public Class searchMidwife

    Dim objdataset As DataSet
    Dim objdataview As DataView
    Dim objcurrencymanager As CurrencyManager

    Private Sub searchButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles searchButton.Click

        If parameterComboBox.Text = "---Please Select---" Then
            MessageBox.Show("PLease select a search parameter", "Midwife Search", _
                              MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub
        End If
        If parameterComboBox.Text <> "---Please Select---" And searchTextBox.Text = "" Then
            MessageBox.Show("Please enter Midwife detail based on selected search parameter", _
                             "Midwife Search", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub
        End If

        If parameterComboBox.Text <> "Staff Code" And searchTextBox.Text <> "" Then
            GetStaffCode()
        ElseIf parameterComboBox.Text = "Phone" And searchTextBox.Text <> "" Then
            GetPhone()
        End If


    End Sub

    Sub GetStaffCode()

        Dim con As SqlConnection = New SqlConnection _
    ("server=localhost; database= MSS; user id= sa; password= clement;")
        Dim objDataAdapter As New SqlDataAdapter( _
             "SELECT * FROM [Midwives] WHERE Staff_Code = '" + searchTextBox.Text + "' ", con)


        Dim objDataSet As DataSet
        Dim objDataView As DataView
        Dim objCurrencyManager As CurrencyManager


        objDataSet = New DataSet()

        ' Fill the DataSet object with data...
        objDataAdapter.Fill(objDataSet, "midwives")

        ' Set the DataView object to the DataSet object...
        objDataView = New DataView(objDataSet.Tables("midwives"))

        ' Set our CurrencyManager object to the DataView object...
        objCurrencyManager = CType(Me.BindingContext(objDataView), CurrencyManager)

        Dim …
Netcode 33 Veteran Poster

Insert Query:

INSERT INTO table_name (column_names) VALUES (data_values)

Update Query:

UPDATE table_name
SET column_name = value
WHERE condition

Delete Query:
DELETE FROM MemberDetails WHERE condition;

Netcode 33 Veteran Poster

mark this thread as solved then

Netcode 33 Veteran Poster

here is a good working code block:

Imports System.Math

Public Class calculator

    Dim cleardisplay As Boolean
    Dim operand1 As Double
    Dim operand2 As Double
    Dim Operator1 As String

    Private Sub Digit_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles btn1.Click, btn2.Click, _
            btn3.Click, btn4.Click, btn5.Click, btn6.Click, _
            btn7.Click, btn8.Click, btn9.Click, btn0.Click
        If cleardisplay Then
            txtDisplay.Text = ""
            cleardisplay = False
        End If
        txtDisplay.Text = txtDisplay.Text + sender.Text
    End Sub

    Private Sub btnPeriod_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPeriod.Click
        If txtDisplay.Text.IndexOf(".") > 0 Then
            Exit Sub
        Else
            txtDisplay.Text = txtDisplay.Text & "."
        End If
    End Sub

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        txtDisplay.Text = ""
    End Sub

    Private Sub btnEquals_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEquals.Click

        Dim result As Double
        operand2 = Val(txtDisplay.Text)
        Select Case Operator1
            Case "+"
                result = operand1 + operand2
            Case "-"
                result = operand1 - operand2
            Case "*"
                result = operand1 * operand2
            Case "/"
                If operand2 <> "0" Then result = operand1 / operand2
        End Select
        txtDisplay.Text = result
        cleardisplay = True
    End Sub

    Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
        operand1 = Val(txtDisplay.Text)
        Operator1 = "+"
        cleardisplay = True
    End Sub

    Private Sub btnPrefix_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrefix.Click
        txtDisplay.Text = -Val(txtDisplay.Text)
        cleardisplay = True
    End Sub

    Private Sub btnInvers_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInverse.Click
        If Val(txtDisplay.Text) <> 0 Then txtDisplay.Text = 1 / Val(txtDisplay.Text)
        cleardisplay = True …
AndreRet commented: Nice post! +4
ErnestSeeker commented: perfect for me +0
Netcode 33 Veteran Poster

simply use:

Textbox1.text = Now.Date
Netcode 33 Veteran Poster

your words are not well explanatory. State clearly what you want

Netcode 33 Veteran Poster

yes, ukshir.....writing your codes to create your own objects are more flexible and
very easy for you to manipulate

Netcode 33 Veteran Poster

for time:

textbox1.text = TimeOfDay.ToShortTimeString

for date:

Today.ToShortDateString()
Netcode 33 Veteran Poster

for clarity and simplicity, just use the white-smoke background colour.
this gives your datagridview a white and ash color for each row. its standard

Netcode 33 Veteran Poster

write some of your codes out so we can figure out where the problem is

Netcode 33 Veteran Poster

OliverQ, here's the SQL syntax to insert record:

Dim objcommand As SqlCommand = New SqlCommand

            With objcommand
                .Connection = objConnection
                .CommandText = "INSERT INTO TableName" & _
               "(Columns separated with commas)" + _
                "VALUES (enter values separated with commas)"
              
            End With

            objConnection.Open()
            objcommand.ExecuteNonQuery()
            objConnection.Close()
Netcode 33 Veteran Poster
DS_Pass1.Tables("PwordStore").Rows(0).Delete()
 Dim cmdbuilder As OleDbCommandBuilder = New oleDbCommandBuilder(OleDAPass)
 OleDAPass.update(DS_Pass1)
Netcode 33 Veteran Poster
My.Computer.Audio.Play("audiofile", AudioPlayMode.WaitToComplete)
Netcode 33 Veteran Poster

good code snippet

Netcode 33 Veteran Poster

syntax errors. avoid too much use of unnecessary procedures.

Netcode 33 Veteran Poster

you need to add a setup project to your main project. steps involved are:
1. click on the file menu, select add, new project
2. on the left pane of the dialog box, select other project types
3. select setup and deployment from the drop down
4. Name your setup project and click ok
5. Make all necessary changes to the stup project like the manufacturer's name and others
6. After all done, click the build menu and click publish
7. check the debug folder located in the bin folder in your project directory to obtain your setup and MSI file

Netcode 33 Veteran Poster
Private Sub ToggleMenus()
        Try

            'Declare a TextBox object and set it to the ActiveControl
            Dim objTextBox As RichTextBox = Me.ActiveControl
            'Toggle the Undo menu items
            tsmUndo.Enabled = objTextBox.CanUndo

            'Toggle the Cut toolbar button and menu items
            tsmCut.Enabled = objTextBox.SelectionLength

            'Toggle the Copy toolbar button and menu items
            tsmCopy.Enabled = objTextBox.SelectionLength

            'Toggle the Paste toolbar button and menu items
            tsmpaste.Enabled = My.Computer.Clipboard.ContainsText

            'Toggle the Select All menu items
            tsmSelectAll.Enabled = _
            objTextBox.SelectionLength < objTextBox.Text.Length
End Sub 

 Private Sub tsmCut_Click(ByVal sender As Object, ByVal e As EventArgs) Handles tsmCut.Click
        ' Use My.Computer.Clipboard to insert the selected text or images into the clipboard
        Dim objTextBox As RichTextBox = Me.ActiveControl
        'Copy the text to the clipboard and clear the field
        objTextBox.Cut()
    End Sub

    Private Sub tsmCopy_Click(ByVal sender As Object, ByVal e As EventArgs) Handles tsmCopy.Click
        ' Use My.Computer.Clipboard to insert the selected text or images into the clipboard
        Dim objTextBox As RichTextBox = Me.ActiveControl
        'Copy the text to the clipboard and clear the field
        objTextBox.Copy()
    End Sub

    Private Sub tsmPaste_Click(ByVal sender As Object, ByVal e As EventArgs) Handles tsmpaste.Click
        'Use My.Computer.Clipboard.GetText() or My.Computer.Clipboard.GetData to retrieve information from the clipboard.
        Dim objTextBox As RichTextBox = Me.ActiveControl
        'Copy the text to the clipboard and clear the field
        objTextBox.Paste()
    End Sub
Netcode 33 Veteran Poster

you have to control the data population from within the form_Load procedure. this would
populate the controls with all necessary data immediately the form is loaded or started up