Pgmer 50 Master Poster Featured Poster

Cant you write Procedure with return values to validate?

Pgmer 50 Master Poster Featured Poster

I just took row(0) as an example... do u have image at row(0)? and column name is proper?

Dim intImage As Integer = 0
        If ds.Tables.Count > 0 Then
            For intImage to ds.tabble(0).rows.count-1
                imgByte = ds.Tables(0).Rows(intImage)("Emp_Image")
                saveImage = New IO.MemoryStream(imgByte)
                PictureBox2.Image = Image.FromStream(saveImage)
            Next
            
        End If
Pgmer 50 Master Poster Featured Poster

before calling u need to set

If Form2.Instance = False Then
' here u need to set its parent form.
            Form2.ShowDialog()
        End If
Pgmer 50 Master Poster Featured Poster
Pgmer 50 Master Poster Featured Poster

I hope u know how to get ur image from DB to dataset. After filling dataset with ur image from DB write the below code.

' assuming ur getting ur image in dataset called dsImage  
           Dim saveImage As IO.MemoryStream
            Dim imgByte As Byte()
            If dsImage.Tables.Count > 0 Then
                imgByte = dsImage.Tables(0).Rows(0)("Image")
                saveImage = New IO.MemoryStream(imgByte)
                Picturebox1.Image = Image.FromStream(saveImage)
            End If
Pgmer 50 Master Poster Featured Poster

u need to convert that to memory stream before showing into picturebox.

Pgmer 50 Master Poster Featured Poster

What is the data type in server where u save the image file?

Pgmer 50 Master Poster Featured Poster

ROX Vi,
Please open a new thread for ur problem. do not post in some one else post.

Pgmer 50 Master Poster Featured Poster

Try something like this..

Private Shared _Instance As Form2 = Nothing
Public Shared Function Instance() As Boolean
        If _Instance Is Nothing OrElse _Instance.IsDisposed = True Then
            _Instance = New Form2
            Return False
        End If
        _Instance.BringToFront()
        Return True
    End Function

In calling form write this

If Form2.Instance = False Then
            Form2.ShowDialog()
        End If
Pgmer 50 Master Poster Featured Poster

So you need to check if already an instance of form is opened or not.. u can use singleton pattern.

Pgmer 50 Master Poster Featured Poster

shann1718
please open a new thread for ur problem.. please do not post into someone else thread.

Pgmer 50 Master Poster Featured Poster

Search in google for Stored procedure with out put parameter.. u will get many examples.

Pgmer 50 Master Poster Featured Poster

Then instead of using SaveFileDialog u can hard code the path u want to save and u need write a method or function whcih saves the pic into database. Use image datatype to save into DB

Pgmer 50 Master Poster Featured Poster

Application.StartupPath

Pgmer 50 Master Poster Featured Poster

You need to write stored procedure which accepts ur edsDesigName.Text.Trim as input. and check if it is already exist in ur table and retur true or false accordingly.
If result is false give the msg to users saying its already exists.

Pgmer 50 Master Poster Featured Poster

Can you please give more info on this? How you want to read Vcards? and all?

Pgmer 50 Master Poster Featured Poster

try this

Try
            Dim savefile As SaveFileDialog = New SaveFileDialog()
            savefile.DefaultExt = "jpeg"
            savefile.Filter = "All files*.*|*.*"
            If savefile.ShowDialog() = DialogResult.OK Then
                Int(Width = PictureBox1.Width)
                Int(Height = PictureBox1.Height)
                Dim Bitmap As Bitmap = New Bitmap(Width, Height)
                Dim rc As Rectangle = New Rectangle(0, 0, Width, Height)
                PictureBox1.DrawToBitmap(Bitmap, rc)
                Bitmap.Save(savefile.FileName,  System.Drawing.Imaging.ImageFormat.Jpeg)
            End If
        Catch ex As Exception
           msgbox(ex.tostring())
        End Try
Pgmer 50 Master Poster Featured Poster

Cant you do it at the back end? it will be easy for you.

Pgmer 50 Master Poster Featured Poster

Please give us ur table details for insert... And also the columns in grid..
or you can get several example on net.. try goggling...

Pgmer 50 Master Poster Featured Poster

what is field? what is values? can give the details?......

Pgmer 50 Master Poster Featured Poster

are you saving ur changes by updating the database trough code?

Pgmer 50 Master Poster Featured Poster
Dim conn As SqlConnection
        Dim strCnn As String = "your connection string;"
        conn = New SqlConnection(strCnn)
        Dim icnt As Int64 = 0
        conn.Open()

        Try


            If DataGridView1.Rows.Count > 0 Then

                Dim cmdInsert As New SqlCommand
                cmdInsert.Connection = conn
                Dim strCommandText As String
                Dim values As String = ""

                strCommandText = "INSERT INTO your insert statement here)VALUES("
                For i As Integer = 0 To DataGridView1.Rows.Count - 1


                    values = strCommandText & "Prepare your Values to pass from Grid i mean get the Cell values you want to insert into db "
                    cmdInsert.CommandText = values
                    icnt = icnt + 1
                    cmdInsert.ExecuteNonQuery()

                    values = ""
                Next
                cmdInsert = Nothing
            End If



        Catch ex As Exception
            MsgBox(icnt.ToString)
            'MsgBox(ex.ToString)
        Finally
            If conn.State = ConnectionState.Open Then
                conn.Close()
            End If
        End Try
Pgmer 50 Master Poster Featured Poster

If ur not loading Millions of records into grid then you can write custom code to serach for perticular record in grid using loop.

Pgmer 50 Master Poster Featured Poster

U mean u want to show the text of selected item on button?

Pgmer 50 Master Poster Featured Poster

Use autocomplete mode and Autocomplte source property of text box.

Pgmer 50 Master Poster Featured Poster

use MASK text box and set the pattern of phone number you want. you can also set ur custom format if you want...

Pgmer 50 Master Poster Featured Poster

Dim str As String = StrConv(txtName.Text, VbStrConv.ProperCase)
txtName.Text = str

Use this while saving ur data as mentioned by Phasma... Whats the problem in it?

Pgmer 50 Master Poster Featured Poster

You should create the login form with two text box and one button. textboxes for user name and password. once user enters the username and password u should authenticate with ur database if user is authenticated then hide the login form and show the main form...

Pgmer 50 Master Poster Featured Poster
Dim str1 As String = "Your string"
        RichTextBox1.Text = str1
        RichTextBox1.SelectionStart = RichTextBox1.Find(str1)

        RichTextBox1.SelectionFont = New Font(RichTextBox1.Font, FontStyle.Bold)

New Font(RichTextBox1.Font, FontStyle.Bold) is having many overloaded methods probalbly you can get something there

Pgmer 50 Master Poster Featured Poster

Use the form closing event

Pgmer 50 Master Poster Featured Poster
Try
            Dim iCell1 As Integer
            Dim icell2 As Integer
            Dim icellResult As Integer
            iCell1 = DataGridView1.CurrentRow.Cells(1).Value
            icell2 = DataGridView1.CurrentRow.Cells(2).Value
            icellResult = iCell1 * icell2
            DataGridView1.CurrentRow.Cells(3).Value = icellResult

        Catch ex As Exception
            MessageBox.Show(ex.ToString)
        End Try
Make sure the selectionMode is set to cellSelect. Once user leaves the cell 3 it will get the calculated values in it.
Pgmer 50 Master Poster Featured Poster

What is ur problem? Ur asking for code for above?

Pgmer 50 Master Poster Featured Poster

Use convert.int(txtbkletnum1.text) or use txtbkletnum1.value instead of .text

Pgmer 50 Master Poster Featured Poster

In the cell leave event of Quantity column multiply the column of item amount and Quantity and set the cell value of total Amount column. And it is nice if u give Save button to save the records..

Pgmer 50 Master Poster Featured Poster

Try below code.. it works for me...

Dim fBrowse As New OpenFileDialog


        With fBrowse
            .Filter = "RTF files(*.rtf)|*.rtf|doc Files(*.doc)|*.doc|All files (*.*)|*.*"
            .FilterIndex = 1
            .Title = "Select any file"
        End With
Pgmer 50 Master Poster Featured Poster

ConnectDatabase() is working? ur pointing to correct DB? cpde looks good. should insert the record... check connections and and connection string.

Pgmer 50 Master Poster Featured Poster

Any error in catch block?

Pgmer 50 Master Poster Featured Poster

Hi Rajesh plz open new thread. do not hijack someone else post. :)

Pgmer 50 Master Poster Featured Poster

Then somewhere else in ur code ComboBox4.datasource=nothing myt be setting. u need to check that.

Pgmer 50 Master Poster Featured Poster

Write the same code in form load event and check combobox4.items.count after MsgBox("Your Account Created Successfully "). hope u will be abale to debug in form load :)

Pgmer 50 Master Poster Featured Poster

Why binding in Selectedindexchanged event? Any reason? What exactly is the need? Cant u try in form load?

Pgmer 50 Master Poster Featured Poster

Yes this is the way. Is ds having data?
Can you check combobox4.items.count after MsgBox("Your Account Created Successfully ")??

Pgmer 50 Master Poster Featured Poster

Try using dataset and set display member and value member to combo. in Select statement itself get the distinct bank names.

Pgmer 50 Master Poster Featured Poster

ur doing Select max(regnum) from order, Where is is the insert statement?

str is getting dbnull values i guess.

Pgmer 50 Master Poster Featured Poster
Private Sub readTextFile(ByVal fileName As String)
        Try
            If Not System.IO.File.Exists(fileName) Then Exit Sub
            Dim strContent As String()
            strContent = System.IO.File.ReadAllLines(fileName)
            Dim x As String = ""
        Catch ex As Exception
             messagebo.show(ex.tostring)
        End Try

    End Sub
Pgmer 50 Master Poster Featured Poster

Then plz mark thread as solved if it solved and if possible post ur code if u have any different approach other than two above.

Pgmer 50 Master Poster Featured Poster

Hi Mitja.
Thanks for above code. i got to learn something today :) My code also works but its not as simple as urs... :)
but what if user enters one extra digit? Will it handle the outof range exception?

Pgmer 50 Master Poster Featured Poster
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim numtoDisturbute As String
        numtoDisturbute = Trim(txtSource.Text)
        If numtoDisturbute.Length = 0 Then Exit Sub
        Dim arr As New List(Of String)

        For Each Cha As Char In numtoDisturbute
            arr.Add(Cha)
        Next

        For i As Integer = 0 To arr.Count - 1
            Dim text As String = arr.Item(i)
            Select Case i
                Case 0
                    TextBox1.Text = text
                Case 1
                    TextBox2.Text = text
                Case 2
                    TextBox3.Text = text
                Case 3
                    TextBox4.Text = text


            End Select

        Next

    End Sub
Pgmer 50 Master Poster Featured Poster

Search in google for stored procedure and see how to use that in ur app.

Pgmer 50 Master Poster Featured Poster

Cool :) Then plz dont forget to mark the thread as solved.