Pgmer 50 Master Poster Featured Poster

Dim x as integer=2.34567
X=math.round(x)
X should hold the value after rounding.

Pgmer 50 Master Poster Featured Poster

Get the value into variable of type date and do date-1 using date functions.

Pgmer 50 Master Poster Featured Poster

Why cant you try Math.round function as suggested by debasis?

Pgmer 50 Master Poster Featured Poster

What is N here? is it holding the upper bound of array?
Get the index of selected item in ur array and use removeat and pass the index.

Pgmer 50 Master Poster Featured Poster

Ckeck the i value when ur deleting. i think it will be allways zero. as u have declared dim i as integer but never assigned the value to it. Problably if u remove first item it is working.

Pgmer 50 Master Poster Featured Poster

If only few values, We can save in Application setting files?

adam_k commented: I agree +6
Pgmer 50 Master Poster Featured Poster

Hi Alex,

As bhagawatshinde mentioned he is having xml file which is to be red.
by mistake i mentioned as excel file. as i was working with excel at that moment.. :)
so i thought its easy to read into dataset and the iterate through dataset.
correct me if i am wrong.

Pgmer 50 Master Poster Featured Poster

Using server.mapmath read the excel file into dataset. dataset is having property called dataset.readxml. then you can insert the data into database.This is is one approach.. there may be any other...

Pgmer 50 Master Poster Featured Poster
Dim mycn As SqlConnection
        Dim strCnn As String = Persist Security Info=False; Data Source=ServerName;UID=userId;PWD=Password ;Initial Catalog=DBName;        mycn= New SqlConnection(strCnn)
        mycn.Open()
        Dim comm As New SqlCommand("your Query", mycn)
        comm.CommandType = CommandType.StoredProcedure
        Dim da As New SqlDataAdapter(comm)
        Dim ds As New DataSet
        da.Fill(ds)
        mycn.close
Pgmer 50 Master Poster Featured Poster
Persist Security Info=False; Data Source=ServerName;UID=userId;PWD=Password ;Initial Catalog=DBName;
Pgmer 50 Master Poster Featured Poster

You want the code to get the data from database? or you have any code?
what exactly u need?

Pgmer 50 Master Poster Featured Poster

Then in the same page u write the code to fecth the records from data base.
Write the stored procedure which accepts the search parameters fetch the data and show

Pgmer 50 Master Poster Featured Poster

You need to handle the else part...:)
Return nothing..

Pgmer 50 Master Poster Featured Poster
MODULE GetDBConnection
        
    Public Function GetConnection() As SqlConnection

        
        Dim cnReturn As SqlConnection
        Dim strConnect As String


        cnReturn = Nothing

        strConnect = “Your connection string”

        cnReturn = New SqlConnection(strConnect)

        cnReturn.Open()
        If cnReturn.State = ConnectionState.Open Then GetConnection =cnReturn


        GetConnection = cnReturn
Else
MsgBox("Failed to acquire an open connection to the database server.  Please check your network connection.")


        Exit Function


        
    End Function

End Module
Pgmer 50 Master Poster Featured Poster

Ur application does only search? or any other pages are there?
If only Search page you can write the code in that page. if u have mupltiple pages probably u need to go for 3 layer architecute.

Pgmer 50 Master Poster Featured Poster

Good..Then please mark the thread as solved.. :)

Pgmer 50 Master Poster Featured Poster

Sorry u need months right? try this

resultdate = DateDiff(DateInterval.Month, date1, date2)

Pgmer 50 Master Poster Featured Poster

What is the field in database? and Call_Date is datetime datatye? it should be datetime. and instead of passing it as parameter u can use system.datetime.now.

Pgmer 50 Master Poster Featured Poster
Dim resultdate As Long

        resultdate = DateDiff(DateInterval.Year, date2, date1)

Try this...

Pgmer 50 Master Poster Featured Poster

Before running the execute query statement, take the select statement and try to run in DB so u will come to know where and what is missing...

Pgmer 50 Master Poster Featured Poster

U want to open in webbrowser? or u want to show the webpage in winform?.

Pgmer 50 Master Poster Featured Poster

Are your files are in debug folders when you build ur application?
in debug mode can u check?

Pgmer 50 Master Poster Featured Poster

Use split function and get only ABC-01

Pgmer 50 Master Poster Featured Poster

you want some application has to run at perticular time?
You can write windows service for it and set the timings when to execute..

Pgmer 50 Master Poster Featured Poster

Yes write it in modlue level. so that all the methods in all the form can use it..
Log the Stracktrace in textfile so that developer will come to know where the error is..

I heard using try catch finally block everywhere is expensive... so do some R&D on try catch and use accordingly..

Pgmer 50 Master Poster Featured Poster

ohh ok I am very sorry i think i have not read it properly before replying.
sorry debasis and sorry jaseem.

debasisdas commented: :) +9
Pgmer 50 Master Poster Featured Poster

sorry we need to add Imports Microsoft.VisualBasic.Compatibility this reference i think.
but jahseem aheamd is not clear he is using vb.net or vb6 code..

Pgmer 50 Master Poster Featured Poster

if he is using vb6 code then why cant he try like this?

combobox1.Items.Add(New VB6.ListBoxItem(rs.fields("code").ToString(), rs.fields("Description").ToString() ))

and the he can access the data using vb6.getitemdata. why to make call to server each time? its expensive i guess..

Pgmer 50 Master Poster Featured Poster

Yes debasis, i asked the same to jaseem.
No need to assign the value to textbox in loop.

cant we get the data into dataset and assign that dataset to combo with value meber and display member? and in selected index changed event we can get the value member of that index and show up in textbox???

Pgmer 50 Master Poster Featured Poster

what you mean by like excel here? you want to have filter like excel filter? or just filtering the records in grid?

Pgmer 50 Master Poster Featured Poster

I have a question for you..
Why your assigning the text1.text=rs!Description in loop?

you want to use the vb6 syntax or pure vb.net code?

why cant u assign dataset to combobox with datasorce property and set value meber and display member property of combo?

Pgmer 50 Master Poster Featured Poster

Please check the framework version in windows 7 and if you develoveped application in 32 bit processor and running it in 64 bit processor can also cause the problem. please check all those things

Pgmer 50 Master Poster Featured Poster

Hi,

Try to get the strsql before you perform retvalue = myCommand.ExecuteNonQuery()
and try to execute that in sql server, so you will come to know if any syntax error or something.

Pgmer 50 Master Poster Featured Poster
Public Class Form1

    Private Sub RichTextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles RichTextBox1.KeyPress
        
        RichTextBox1.Text = RichTextBox1.Text & " Not available "
        RichTextBox1.Select(RichTextBox1.Text.Length, 0)

    End Sub
End Class
Pgmer 50 Master Poster Featured Poster

Just concatinate vbcrlf where ever u want to go for new line

Pgmer 50 Master Poster Featured Poster
Dim strS As String() = Nothing
            Dim actaulstring As String = ""
            strS = RichTextBox1.Text.Split("=")
            actaulstring = strS.GetValue(2)
            strS = actaulstring.Split(">")
            actaulstring = strS(0)
            TextBox2.Text = actaulstring
Pgmer 50 Master Poster Featured Poster
Dim strS As String() = Nothing
            Dim actaulstring As String = ""
            strS = RichTextBox1.Text.Split("=")
            actaulstring = strS.GetValue(1)
            strS = actaulstring.Split(">")
            actaulstring = strS(0)
            TextBox2.Text = actaulstring
Pgmer 50 Master Poster Featured Poster
Dim myConnection2 As New SqlClient.SqlConnection()
        Dim myCommand2 As New SqlClient.SqlCommand()

        Dim da As SqlDataAdapter
        Dim ds As New DataSet


        Try
            ' lstReader.Items.Clear()

            myConnection2.ConnectionString = "Data Source=User-PC;Initial Catalog=patientrecords;Integrated Security=True"

            myConnection2.Open()

            myCommand2.CommandText = "SELECT [Child_First_Name], [Child_Last_Name], [Child_DOB] FROM Parent_Details " & _
            "WHERE [Parent_First_Name] = '" & txtFName.Text & "'  AND " & _
            " [Parent_Last_Name] = '" & txtLName.Text & "' order By [Child_First_Name], [Child_Last_Name], [Child_DOB] ; "




            myCommand2.Connection = myConnection2
            da = New SqlDataAdapter(myCommand2)
            da.Fill(ds)
            If ds.Tables.Count > 0 Then
                DataGridView1.DataSource = ds
            Else
                MsgBox("Record does not exist")
            End If
          

        Catch el As Exception
            Console.WriteLine(el.Message)

        Finally
            If myConnection2.State = ConnectionState.Open Then
                myConnection2.Close()
            End If
        End Try
Pgmer 50 Master Poster Featured Poster

Then get that data into dataview sort or find you can do, even in dataset you can find for perticlar record before assigning to the grid

Pgmer 50 Master Poster Featured Poster

Use data adapter and dataset objects and fill dataset with records and then

Datagridview.datasource=dataset.table("Tablename").

What if user wants to search only on first name or only on last name? If eaither of textbox are emty will ur sql statement gives u record?

Pgmer 50 Master Poster Featured Poster

Check with autocomplete and autofill property of textbox.
get ur data to Customem list as set the property..

Pgmer 50 Master Poster Featured Poster

how ur passing the date from Front end? as a datetime ? or string?
Whats ur DB datatype for that column???

Pgmer 50 Master Poster Featured Poster

can you please try to check for null value before taking the length

something like

If isnull(sheetContent.Range("A" & exRow).Value2.ToString.Length)
Pgmer 50 Master Poster Featured Poster

You can go for threads where u can give some pause..
m i right debasis?

Pgmer 50 Master Poster Featured Poster

Do u have permision on file?
Is File is read only?
Check out

Pgmer 50 Master Poster Featured Poster

Please mark the thread as solved. when it is solved.

Pgmer 50 Master Poster Featured Poster

If both the control are same which u want to fire then you can do something like this.

Private Sub Label1_Click(ByVal sender As Object, ByVal e As System.EventArgs)Handles Label1.Click, Label2.Click, Label3.Click
' Your code what u want to do
End Sub
Pgmer 50 Master Poster Featured Poster

ya izyrider is correct. when click on one control u want to fire one more control that you can do..

Pgmer 50 Master Poster Featured Poster

Plz mark the thread as solved

Pgmer 50 Master Poster Featured Poster

Hi Devanadhan,

U need to use autocomplete source and autocomplete mode property of combo to do that.

And plz start new thread dont post is some one else post