Pgmer 50 Master Poster Featured Poster
' Declare at form level
   Dim objRandom As New System.Random( _
   CType(System.DateTime.Now.Ticks Mod System.Int32.MaxValue, Integer))

   Public Function GetRandomNumber( _
    Optional ByVal Low As Integer = 1, _
    Optional ByVal High As Integer = 100) As Integer
        ' Returns a random number,
        ' between the optional Low and High parameters
        Return objRandom.Next(Low, High + 1)
    End Function

' Using the above function to generate Random numbers.  
  Dim intDiceRoll As Integer
        intDiceRoll = GetRandomNumber(1, 1000000)
        MessageBox.Show("You rolled a " & intDiceRoll.ToString)
Pgmer 50 Master Poster Featured Poster
Try
            Dim cn As SqlConnection
            Dim strCnn As String = "Your data base connection string"
            cn = New SqlConnection(strCnn)
            cn.Open()
            Dim comm As New SqlCommand("Your sp or Command text to get the data from DB", cn)
            '' If ur using Sp then Commandtype= CommandType.StoredProcedure if it is Text then comm.CommandType=CommandType.Text
            comm.CommandType = CommandType.StoredProcedure
            Dim ds As SqlDataReader
            ds = comm.ExecuteReader
            If ds.HasRows Then
                While ds.Read
                    ''
                    ' do what u want here using the data
                End While
            End If

            ''Close your connections and commands.
            cn.Close()
        Catch ex As Exception
            ''Handle error if any
        End Try
Pgmer 50 Master Poster Featured Poster

What count you want to show? Where is the execute reader in your code here?
This half code does not explain anything...

Pgmer 50 Master Poster Featured Poster
Dim arrImage() As Byte
        Dim openFile As New OpenFileDialog
        If openFile.ShowDialog() = Windows.Forms.DialogResult.OK Then
            arrImage = System.IO.File.ReadAllBytes(openFile.FileName)
        Else
            Exit Sub
        End If
Pgmer 50 Master Poster Featured Poster

Hey vasim,
Can you explain what you want? Which kind of application it is? And where ur saving the iindex? What is this index is all about?

Pgmer 50 Master Poster Featured Poster

In dataview you can filter and show the result in grid, In database also you can filter and get the desired result set. choose what you want to do.
What is the problem you are facing when ur filtering in dataview? Can you post the bit more code? and problem details?

Pgmer 50 Master Poster Featured Poster

Happens :)

Pgmer 50 Master Poster Featured Poster

Which index you want to find? Explain in detail.

Pgmer 50 Master Poster Featured Poster

filter at the backend server only?

Pgmer 50 Master Poster Featured Poster
Dim myTabPage0 As New TabPage()
        myTabPage0.Text = "Event " & (TabControl1.TabPages.Count + 1)
        TabControl1.TabPages.Add(myTabPage0)
        Dim txt As New TextBox
        txt.Text = "Test"
        myTabPage0.Controls.Add(txt)

Try if this helps u

Pgmer 50 Master Poster Featured Poster

without installing framework you want to run your application on client system?

Pgmer 50 Master Poster Featured Poster

is it web or windows? at very first post aadi mentioned as windows and in windows we will not have Sessions

Pgmer 50 Master Poster Featured Poster

The code i posted is working fine for me in my project.
if you can send your excel file column names and Sheet name we can try out.

Pgmer 50 Master Poster Featured Poster

select Columns names from [sheet$]
Columns names are you column names in excel and Sheet$ is the name of ur sheet in excel from where you want to import. If it is one time activivty do it using Maping from SQL wizard or else write code as shown above...

Pgmer 50 Master Poster Featured Poster

Why ur doing E.formatedvalue? instead you can get the cell text using Activecell.text right?

Pgmer 50 Master Poster Featured Poster

Try your code in Cell Enter event, cell leave event and see. And if Not valid entry then dont forget to clear the cell.

Pgmer 50 Master Poster Featured Poster
Try
            Dim fBrowse As New OpenFileDialog

            With fBrowse
                .Filter = "Excel files(*.xls)|*.xls|All files (*.*)|*.*"
                .FilterIndex = 1
                .Title = "Import data from Excel file"
            End With
            If fBrowse.ShowDialog() = Windows.Forms.DialogResult.OK Then
                Dim fname As String
                fname = fBrowse.FileName
                Dim MyConnection As System.Data.OleDb.OleDbConnection
                Dim DtSet As System.Data.DataSet
                Dim MyCommand As System.Data.OleDb.OleDbDataAdapter
                MyConnection = New System.Data.OleDb.OleDbConnection _
                ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & fname & ";" & "Extended Properties=""Excel 8.0;HDR=NO;IMEX=1""")
                MyCommand = New System.Data.OleDb.OleDbDataAdapter("select Columns names from [sheet$]", MyConnection)
                
                MyCommand.TableMappings.Add("Table", "Ur table name.")
                DtSet = New System.Data.DataSet
                MyCommand.Fill(DtSet)
'If dataset is not empty Then write code here to insert values to DB.
                MyConnection.Close()
            End If
  Catch ex As Exception
            MessageBox.Show(ex.ToString)
        End Try

After getting the data into data set. loop throgh ur dataset and insert the values in to DB. There myt be many techniques for this... but i know this one. you can dirctly map the Excel file to SQL using SQL wizard.

Pgmer 50 Master Poster Featured Poster

Use math.round method u can pass how many digits you want to show.
And from next time, plz mark thread as solved and create new for new Query..

Pgmer 50 Master Poster Featured Poster

Ur letting the user to enter the data in gridview cell?

Pgmer 50 Master Poster Featured Poster

Hi mitja,
I have a doubt here... if Questions are in more say 100+ then ?

Pgmer 50 Master Poster Featured Poster

At which line are u getting the error?

Pgmer 50 Master Poster Featured Poster

get those values into integers and compare.

Dim param As Integer = 122
        Dim compval As Integer = Label.Text
        If compval > param Then
            MsgBox("greater")
        Else
            MsgBox("Less")
        End If

This is just sample.. you need to make changes in ur case

Pgmer 50 Master Poster Featured Poster

You want to insert the selected value in combobox? or all?

Pgmer 50 Master Poster Featured Poster

Are you using Database for ur application ? if yes which database are u using?

Pgmer 50 Master Poster Featured Poster

Is it the code snippet?
Then put it in Snippets using code tags..

Pgmer 50 Master Poster Featured Poster

you want to concatinate multiple values from DB and add to combo?

Pgmer 50 Master Poster Featured Poster

Why cant you load the types into combobox? and when selected index changed and selected item is "Software" get the data for Software or u can use dataview for this and rebind the grid..

Pgmer 50 Master Poster Featured Poster

See if this helps you... you need to give the propernames what you gave in design.

Private Sub Label3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label3.Click, Label4.Click, Label5.Click, Label6.Click
        Dim blblclick1 As Boolean
        Dim blblclick2 As Boolean
        Dim blblclick3 As Boolean
        Dim blblclick4 As Boolean


        Select Case sender.name.ToString
            Case "Label1"
                blblclick1 = True
            Case "Label2"
                If blblclick1 = False Then
                    MessageBox.Show("Please click label 1 first")
                End If
            Case "Label3"
                If blblclick2 = False Then
                    MessageBox.Show("Please click label 2 first")
                End If
            Case "Label4"
                If blblclick3 = False Then
                    MessageBox.Show("Please click label 3 first")
                End If
            Case "Label5"
                If blblclick4 = False Then
                    MessageBox.Show("Please click label 4 first")
                End If


        End Select

    End Sub
Pgmer 50 Master Poster Featured Poster

What is the name u gave to the label to identify?

Pgmer 50 Master Poster Featured Poster

8 fixed lables? are you putting them in Panel or gropu box?
And what are the names you have given them to identify the sequence?

Pgmer 50 Master Poster Featured Poster

use picturebox.load method and pass ur Apppath where u keeping the pic.

Dim picpath As String
        picpath = Application.StartupPath & "\img1.jpg"
        picturebox1.Load(picpath)

make sure pic will be there in the apppath

Pgmer 50 Master Poster Featured Poster

Ruchi224 please mark the thread as solved if its is solved.
It helps the forum to maintain clean.. dont just escape after getting the soluution. Actulally i should post this.. but i saw two of ur post are solved but u forgot to mark as solved.

Pgmer 50 Master Poster Featured Poster

you want to update the same file? first delete the content and using io.write u can write back and save...

Pgmer 50 Master Poster Featured Poster

you want to get the each item in richtextbox?

Pgmer 50 Master Poster Featured Poster

Go to the properties of lable.. under Image select the image u want to assign.
Make the text emty. And set autosize=false and set the size you want.

Pgmer 50 Master Poster Featured Poster

Have you checked the database for record after insert?

Pgmer 50 Master Poster Featured Poster

At what line of code ur getting the error?

Imports System.Data
Imports System.Data.OleDb
Imports System.EventArgs
Imports System.Data.OleDb.OleDbCommand
Imports System.Data.OleDb.OleDbConnection

Public Class ContactInfo_supp
Inherits System.Windows.Forms.Form

Dim Message As String
Dim cn As OleDbConnection
Dim cmd As OleDbCommand



Private Sub button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button3.Click

Try
'MsgBox("Open")
cn = New OleDbConnection("Provider=microsoft.jet.oledb.4.0;Data Source=E:\Project-Hemtech\HemDatabase1.mdb;")
cn.Open()
cmd = New OleDbCommand("insert into contactinfo(usertype,compname,compadd,compcity,comppin,compphcode,compph,compfaxcode,compfax,compmail,compsite,compregoff,compfact,products,interest,region,place,contper1,comprole1,compemail1,contnum1,ext1,mobnum1,contper2,comprole2,compemail2,contnum2,ext2,mobnum2,contper3,comprole3,compemail3,contnum3,ext3,mobnum3,weeklyoff,vat,cst,pan,ecc,commissionerate,range,division,servicetax,bankname,bankbranch,accnum,rtgs,instrname,modelnum,installdate,amc,callibration,period,expdate) values ('Supplier','" & textBox1.Text & "','" & textBox2.Text & "','" & textBox39.Text & "','" & textBox41.Text & "','" & textBox45.Text & "','" & textBox3.Text & "','" & textBox4.Text & "','" & textBox46.Text & "','" & textBox5.Text & "','" & textBox6.Text & "','" & textBox7.Text & "','" & textBox8.Text & "','" & textBox42.Text & "','" & textBox43.Text & "','" & ComboBox1.SelectedItem.ToString() & "','" & textBox44.Text & "','" & textBox9.Text & "','" & textBox10.Text & "','" & textBox47.Text & "','" & textBox11.Text & "','" & textBox12.Text & "','" & textBox13.Text & "','" & textBox18.Text & "','" & textBox17.Text & "','" & textBox48.Text & "','" & textBox16.Text & "','" & textBox15.Text & "','" & textBox14.Text & "','" & textBox23.Text & "','" & textBox22.Text & "','" & textBox49.Text & "','" & textBox21.Text & "','" & textBox20.Text & "','" & textBox19.Text & "','" & textBox50.Text & "','" & textBox25.Text & "','" & textBox26.Text & "','" & textBox27.Text & "','" & textBox28.Text & "','" & textBox29.Text & "','" & textBox30.Text & "','" & textBox31.Text & "','" & textBox32.Text & "','" & textBox33.Text & "','" & textBox34.Text & "','" & textBox35.Text & "','" & …
Pgmer 50 Master Poster Featured Poster
Pgmer 50 Master Poster Featured Poster

Then plz could you mark the thread as solved?

Pgmer 50 Master Poster Featured Poster

The above code by Unhnd_Exception works fine...

Pgmer 50 Master Poster Featured Poster

What error ur getting?

Pgmer 50 Master Poster Featured Poster

Hi codeorder,
Are you showing windows stand alone app in browser?

Pgmer 50 Master Poster Featured Poster

you can show the browser in vb.net form but not sure .net form on browser..
What is the need to show form on browser?

may be you can get something here

Pgmer 50 Master Poster Featured Poster

Usually Module should contain the method or functions which can be used in all the forms of projects. Example: Error handler code, database connections etc..

debasisdas commented: agree +13
Pgmer 50 Master Poster Featured Poster

There is no built in controls i guess. you may need to look for third party controls or write your own. using random string generation...

Pgmer 50 Master Poster Featured Poster

Are you looking for specific textbox to get the value of num , num 2,num 3?

Pgmer 50 Master Poster Featured Poster
Dim txtMo As TextBox
        For Each ctrl As Control In Me.Controls
            If (ctrl.Name.StartsWith("txtDimVal")) AndAlso (TypeOf ctrl Is TextBox) Then
                txtMo = DirectCast(ctrl, TextBox)
                MsgBox(txtMo.Text)
            End If
        Next ctrl

you want to compare the text?

Pgmer 50 Master Poster Featured Poster

web application? are you using any third party control for captcha?

Pgmer 50 Master Poster Featured Poster

you need to show the 2nd form first before calling tabpage2.show.

dim objfrm as new form2
         objfrm.show()
         TabPages2.show()

im not sure abt TabPages2.show()
u may need to do activate or someother things.. try out

Pgmer 50 Master Poster Featured Poster

What is the issue or problem with above code? i mean whats not hapening?

EDIT: have you declared txtmemo as textbox?
and what is MsgBox(txtMo)? txtmemo.name? txtmemo.text?