Visual Basic, .NET, ASP, VBScript
 

   
   
     

Форум - .NET

Страница: 1 | 2 | 3 | 4 |

 

  Вопрос: ListView, Highlight строку Добавлено: 01.09.10 22:40  

Автор вопроса:  

Ответить

  Ответы Всего ответов: 46  

Номер ответа: 16
Автор ответа:
 AgentFire



ICQ: 192496851 

Вопросов: 75
Ответов: 3178
 Профиль | | #16 Добавлено: 03.09.10 09:57
Код тем не менее вставить не удастся изза многоточий и, как следствие, потерь кода, так что настоятельно советую залить файл проекта на хостинг или просто показать уменьшенную копию проблемы (тот же код или проект, содержащий только табвью, листвью и код где ВЫ пытаетесь сфокусироваться на листе..), чтобы не нужно было искать где же там у ВАС косяк.

Ответить

Номер ответа: 17
Автор ответа:
 



Вопросов: 1
Ответов: 26
 Профиль | | #17 Добавлено: 03.09.10 15:18

Imports System.Data
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.IO

Module modDogLicense
    Public connString As String = ";Data Source=SqlSrvSqlSrv; Initial Catalog=DogLicense; Integrated Security=SSPI;"
    ;Dim QueryDCL As String
    Public connDCL As New SqlConnection(connString)
    Public connOwner As New SqlConnection(connString)
    Public connAdapter As New SqlDataAdapter(QueryDCL, connDCL)
    Public dsDCL As New DataSet
    Public drRow As DataRow
    Public drRowDogs As DataRow
    Public drRowVac As DataRow
    Public indRowNumber As Integer
    Public SqlCommand As New SqlCommand
    Public AddMode As Boolean
    Public ClientID As String = ""
    Public ClientTable As String
    Public DataBase As String
    Public DogID As String
    Public DogsTable As String
    Public EditMode As Boolean
    Public Order As String
    Public OwnerInd As Int16
    Public OwnersTable As String
    Public SqlStatement As String
    Public VaccinationTable As String
    Public VacID As Integer

   Sub Main()
        ;DataBase = "Live"
        OwnersTable = ";DCLDogOwners"
        ;DogsTable = ";DCLDogs"
        VaccinationTable = ";DCLVaccination"
        SqlCommand.Connection = connDCL
        connDCL.Open()
    End Sub

Public Class frmDCLMain

    Private Sub DogLicensesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DogLicensesToolStripMenuItem.Click
        frmDogsAndCats.ShowDialog()
    End Sub

   Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()
    End Sub

   Private Sub frmDCLMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Main()
    End Sub

Public Class frmDogsAndCats
    ;Dim litem As ListViewItem
    ;Dim expired As String = "0"
    ;Dim SelDog As Int16
    ;Dim SqlStatementSecur As String
    ;Dim VacInd As Integer

    Private Sub frmDogsAndCats_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        ClientID = "030018"
        Enable_Owner(False)
        ;DisplayOwner()
    End Sub

    Sub DisplayOwner()
        SqlStatement = "Select * from " & OwnersTable & " Where clientid = '" & ClientID & "'"
        connAdapter.SelectCommand.CommandText = SqlStatement
        If Not dsDCL.Tables("SelectedOwner";) Is Nothing Then
            dsDCL.Tables("SelectedOwner";).Clear()
        End If
        connAdapter.SelectCommand.CommandType = CommandType.Text
        connAdapter.Fill(dsDCL, "SelectedOwner";)
        drRow = dsDCL.Tables("SelectedOwner";).Rows(0)
        txtClientID_pgeOwners.Text = ClientID
        txtOwner_pgeOwners.Text = Trim(drRow.Item("Customer";) & " ";)
        Customer = txtOwner_pgeOwners.Text
        txtAddr_pgeOwners.Text = Trim(drRow.Item("Address1";) & " ";)
        txtAddr2_pgeOwners.Text = Trim(drRow.Item("Address2";) & " ";)
        txtCity.Text = Trim(drRow.Item("city";) & " ";)
        txtZIP.Text = Trim(drRow.Item("zip";) & " ";)
        cmbState.Text = Trim(drRow.Item("state";) & " ";)
        txtPhone1.Text = Trim(drRow.Item("phone1";) & " ";)
        txtPhone2.Text = Trim(drRow.Item("phone2";) & " ";)
        If Not Trim(drRow.Item("paiddtd";).ToString & " ";) = "" Then
            If Not CDate(Trim(drRow.Item("paiddtd";).ToString & " ";)) = #1/1/1990# Then
                txtPaidDate.Text = drRow.Item("paiddtd";)
            Else
                txtPaidDate.Text = ""
            End If
            txtPaidDate.Text = ""
        End If
        rtbComments.Text = Trim(drRow.Item("comments";) & " ";)
        CityStateZIP = Trim(txtCity.Text) & ", " & cmbState.Text & " " & txtZIP.Text
        cmdPrior.Enabled = True
        cmdFirst.Enabled = True
        cmdNext.Enabled = True
        cmdLast.Enabled = True
        BeginOfFile = False
        EndOfFile = False
        If OwnerInd = dsDCL.Tables(";DogOwners";).Rows.Count - 1 Then
            cmdNext.Enabled = False
            cmdLast.Enabled = False
            EndOfFile = True
        End If
        If OwnerInd = 0 Then
            cmdPrior.Enabled = False
            cmdFirst.Enabled = False
            BeginOfFile = True
        End If
        If Order = "Name" Then
            cmdOrder.Text = "SWITCH TO ORDER BY CLIENT ID"
        Else
            cmdOrder.Text = "SWITCH TO ORDER BY CLIENT NAME"
        End If
        pgfDogsInfo.SelectedIndex = 0
        pgeOwners.Select()
    End Sub

    Sub DisplayDogs()
        SqlStatement = "Select * from " & DogsTable & " Where clientid = '" & ClientID & "'"
        SqlStatement &= " Order By Dog_ID"
        connAdapter.SelectCommand.CommandText = SqlStatement
        If Not dsDCL.Tables("SelectedDogs";) Is Nothing Then
            dsDCL.Tables("SelectedDogs";).Clear()
        End If
        connAdapter.SelectCommand.CommandType = CommandType.Text
        connAdapter.Fill(dsDCL, "SelectedDogs";)
        lsvDogs.Items.Clear()
        If dsDCL.Tables("SelectedDogs";).Rows.Count = 0 Then
            litem = lsvDogs.Items.Add(" ";)
            litem.SubItems.Add("No Dogs On File For This Owner";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            SelDog = 0
        Else
            ;Dim rowcount As Int16 = dsDCL.Tables("SelectedDogs";).Rows.Count
            ;Dim rowi As Int16 = 0
            For Each drRowDogs In dsDCL.Tables("SelectedDogs";).Rows
                litem = lsvDogs.Items.Add(drRowDogs.Item(";Dog_ID";))
                litem.SubItems.Add(drRowDogs.Item("FullName";))
                litem.SubItems.Add(drRowDogs.Item("Breed";))
                litem.SubItems.Add(drRowDogs.Item("Gender";))
                litem.SubItems.Add(drRowDogs.Item(";Dog_Color";))
                litem.SubItems.Add(drRowDogs.Item("Birthday";).ToString)
                litem.SubItems.Add(drRowDogs.Item("Species";))
                litem.SubItems.Add(drRowDogs.Item("Weight";))
                litem.SubItems.Add(drRowDogs.Item(";Deprived";))
                litem.SubItems.Add(drRowDogs.Item("Reason";))
            Next
            If AddMode = True Then
                SelDog = rowcount - 1
            ElseIf EditMode = False Then
                SelDog = 0
            End If
        End If
        txtClientID_pgeDogs.Text = txtClientID_pgeOwners.Text
        txtOwner_pgeDogs.Text = txtOwner_pgeOwners.Text
        txtAddr_pgeDogs.Text = txtAddr_pgeOwners.Text
        txtAddr2_pgeDogs.Text = txtAddr2_pgeOwners.Text
        lsvDogs.Items(SelDog).ListView.Select()
        lsvDogs.Items(SelDog).Selected = True
    End Sub

    Sub DisplayVaccination(ByVal VacID_Ind As Integer)
        SqlStatement = "Select * from " & VaccinationTable & " Where clientid = '" & ClientID
        SqlStatement &= "' AND dog_id = '" & DogID & "' Order By ClientID, Dog_ID, vacdate, expdate, vacid"
        connAdapter.SelectCommand.CommandText = SqlStatement
        If Not dsDCL.Tables("VaccinationTable";) Is Nothing Then
            dsDCL.Tables("VaccinationTable";).Clear()
        End If
        connAdapter.SelectCommand.CommandType = CommandType.Text
        connAdapter.Fill(dsDCL, "VaccinationTable";)
        lsvTags.Items.Clear()
        VacInd = 0
        If dsDCL.Tables("VaccinationTable";).Rows.Count = 0 Then
            litem = lsvTags.Items.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add("No Vaccinations On File For This Dog/Cat";)
            litem.SubItems.Add(0)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(" ";)
            litem.SubItems.Add(0)
        Else
            ;Dim test_str As Date
            ;Dim test_decimal As Decimal = 0.0
            ;Dim rowcount As Int16 = dsDCL.Tables("VaccinationTable";).Rows.Count
            ;Dim rowi As Int16 = 0
            ;Dim i As Int16 = 0
            For Each drRow In dsDCL.Tables("VaccinationTable";).Rows
                litem = lsvTags.Items.Add(drRow.Item("TagNumber";))
                test_str = drRow.Item("VacDate";)
                litem.SubItems.Add(test_str.ToShortDateString)
                test_str = drRow.Item("ExpDate";)
                litem.SubItems.Add(test_str.ToShortDateString)
                litem.SubItems.Add(drRow.Item("ChargeType";))
                litem.SubItems.Add(drRow.Item("Amount";).ToString)
                litem.SubItems.Add(drRow.Item("ClinicName";))
                litem.SubItems.Add(Trim(drRow.Item("License";) & " ";))
                litem.SubItems.Add(drRow.Item("For_Year";))
                If Trim(drRow.Item(";DueDate";).ToString & " ";) = "" Then
                    litem.SubItems.Add(" ";)
                Else
                    test_str = drRow.Item(";DueDate";)
                    litem.SubItems.Add(test_str.ToShortDateString)
                End If
                litem.SubItems.Add(drRow.Item("LetterSent";))
                litem.SubItems.Add(Trim(drRow.Item("walkin";) & " ";))
                test_str = drRow.Item("PayDate";)
                litem.SubItems.Add(test_str.ToShortDateString)
                litem.SubItems.Add(Trim(drRow.Item("Purchased";) & " ";))
                litem.SubItems.Add(Trim(drRow.Item("Cashier";) & " ";))
                For rowi = 0 To PaymentArray.Length - 1
                    If Trim(drRow.Item("PayType";) & " ";) = PaymentArray(rowi).PmntCode Then
                        Exit For
                    End If
                Next
                If rowi = PaymentArray.Length Or PaymentArray(rowi).PmntCode = "" Then
                    litem.SubItems.Add(" ";)
                Else
litem.SubItems.Add(Trim(PaymentArray(rowi).PmntName))
                End If
                litem.SubItems.Add(Trim(drRow.Item("Check_no";) & " ";))
                litem.SubItems.Add(Trim(drRow.Item("Expired";) & " ";))
                litem.SubItems.Add(drRow.Item("VacID";).ToString)
                If VacID_Ind > 0 And VacID_Ind = drRow.Item("VacID";) Then
                    VacInd = i
                End If
                i += 1
            Next
            If AddMode = True Then
                VacInd = rowcount - 1
            End If
        End If
        txtClientID_pgeVaccination.Text = txtClientID_pgeOwners.Text
        txtOwner_pgeVaccination.Text = txtOwner_pgeOwners.Text
        txtAddr_pgeVaccination.Text = txtAddr_pgeOwners.Text
        txtAddr2_pgeVaccination.Text = txtAddr2_pgeOwners.Text
        txtDogID_pgeVaccination.Text = txtDogID_pgeDogs.Text
        txtDogName_pgeVaccination.Text = txtDogName_pgeDogs.Text
        txtBreed_pgeVaccination.Text = txtBreed_pgeDogs.Text
        lsvTags.Items(VacInd).ListView.Select()
        lsvTags.Items(VacInd).Selected = True
    End Sub

    Private Sub pgfDogsInfo_Selected(ByVal sender As Object, ByVal e As System.Windows.Forms.TabControlEventArgs) Handles pgfDogsInfo.Selected
        Select Case e.TabPageIndex
            Case Is = 1
                If AddMode = True Or EditMode = True Then
                    Enable_Dogs(True)
                Else
                    Enable_Dogs(False)
                End If
                ;DisplayDogs()
            Case Is = 2
                If AddMode = True Or EditMode = True Then
                    Enable_Vaccination(True)
                Else
                    Enable_Vaccination(False)
                End If
                ;DisplayVaccination(0)
        End Select
    End Sub

    Private Sub lsvDogs_ItemSelectionChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.ListViewItemSelectionChangedEventArgs) Handles lsvDogs.ItemSelectionChanged
        ;Dim birthday_str As String
        ;Dim birthday As String
        ;Dim birthday_date As Date
        If e.IsSelected = True Then
            SelDog = e.ItemIndex
            If dsDCL.Tables("SelectedDogs";).Rows.Count = 0 Then
                ;DogID = ""
                txtDogID_pgeDogs.Text = ""
                txtDogName_pgeDogs.Text = ""
                txtBreed_pgeDogs.Text = ""
                txtSex.Text = ""
                txtColor.Text = ""
                cmbSpecies.SelectedIndex = -1
                txtWeight.Text = ""
                mtbBirthday.Text = ""
                txtReason.Text = ""
                chkRemoved.Checked = False
            Else
                ;DogID = lsvDogs.Items(e.ItemIndex).Text
                txtDogID_pgeDogs.Text = lsvDogs.Items(e.ItemIndex).Text
                txtDogName_pgeDogs.Text = lsvDogs.Items(e.ItemIndex).SubItems(1).Text
                txtBreed_pgeDogs.Text = lsvDogs.Items(e.ItemIndex).SubItems(2).Text
                txtSex.Text = lsvDogs.Items(e.ItemIndex).SubItems(3).Text
                txtColor.Text = lsvDogs.Items(e.ItemIndex).SubItems(4).Text
                cmbSpecies.Text = lsvDogs.Items(e.ItemIndex).SubItems(6).Text
                txtWeight.Text = lsvDogs.Items(e.ItemIndex).SubItems(7).Text
                birthday = lsvDogs.Items(e.ItemIndex).SubItems(5).Text
                If Not Trim(birthday) = "" Then
                    birthday_date = CDate(birthday)
                    If Not birthday_date = #1/1/1900# Then
                        birthday = birthday_date.ToShortDateString
                        birthday_str = Mid(birthday, 1, Len(birthday) - 5)
                        Select Case Len(birthday_str)
                            Case 3
                                birthday_str = "0" & Mid(birthday_str, 1, 1) & "0" & Mid(birthday_str, 3, 1)
                            Case 4
                                If Mid(birthday_str, 2, 1) = "/" Then
                                    birthday_str = "0" & Mid(birthday_str, 1, 1) & Mid(birthday_str, 3, 2)
                                Else
                                    birthday_str = Mid(birthday_str, 1, 2) & "0" & Mid(birthday_str, 4, 1)
                                End If
                            Case 5
                                birthday_str = Mid(birthday_str, 1, 2) & Mid(birthday_str, 4, 2)
                        End Select
                        birthday = birthday_str & Mid(birthday, Len(birthday) - 3, 4)
                        mtbBirthday.Text = birthday
                    Else
                        mtbBirthday.Text = ""
                    End If
                End If
                txtReason.Text = lsvDogs.Items(e.ItemIndex).SubItems(9).Text
                chkRemoved.Checked = IIf(lsvDogs.Items(e.ItemIndex).SubItems(8).Text = "Y", True, False)
            End If
        End If
    End Sub

    Private Sub lsvTags_ItemSelectionChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.ListViewItemSelectionChangedEventArgs) Handles lsvTags.ItemSelectionChanged
        ;Dim i As Int16
        ;Dim DateToStr As String
        ;Dim DateToStr1 As String
        If e.IsSelected = True Then
            VacInd = e.ItemIndex
            If dsDCL.Tables("VaccinationTable";).Rows.Count = 0 Then
                txtTagNumber.Text = ""
                cmbClinics.SelectedIndex = -1
                mtbVacDate.Text = ""
                mtbExpDate.Text = ""
                mtbDueDate.Text = ""
                mtbPayDate.Text = ""
                cmbChargeType.SelectedIndex = -1
                txtChargeAmount.Text = ""
                chkLetterSent.Checked = False
                chkWalkIn.Checked = False
                txtYear.Text = ""
                txtLicense.Text = ""
                cmbPurchased.SelectedIndex = -1
                txtCashier.Text = ""
                cmbPmntType.SelectedIndex = -1
                txtCheckNo.Text = ""
                expired = "0"
                VacID = 0
            Else
                txtTagNumber.Text = lsvTags.Items(e.ItemIndex).Text
                If Trim(lsvTags.Items(e.ItemIndex).SubItems(5).Text) = "" Then
                    cmbClinics.SelectedIndex = -1
                Else
                    cmbClinics.Text = lsvTags.Items(e.ItemIndex).SubItems(5).Text
                End If
                VacDate = CDate(lsvTags.Items(e.ItemIndex).SubItems(1).Text.ToString)
                If Not CDate(lsvTags.Items(e.ItemIndex).SubItems(1).Text) = #1/1/1900# Then
                    ;DateToStr = CDate(lsvTags.Items(e.ItemIndex).SubItems(1).Text).ToShortDateString
                    ;DateToStr1 = Mid(DateToStr, 1, Len(DateToStr) - 5)
                    Select Case Len(DateToStr1)
                        Case 3
                            ;DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & "0" & Mid(DateToStr1, 3, 1)
                        Case 4
                            If Mid(DateToStr1, 2, 1) = "/" Then
                                ;DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & Mid(DateToStr1, 3, 2)
                            Else
                                ;DateToStr1 = Mid(DateToStr1, 1, 2) & "0" & Mid(DateToStr1, 4, 1)
                            End If
                        Case 5
                            ;DateToStr1 = Mid(DateToStr1, 1, 2) & Mid(DateToStr1, 4, 2)
                    End Select
                    ;DateToStr = DateToStr1 & Mid(DateToStr, Len(DateToStr) - 3, 4)
                    mtbVacDate.Text = DateToStr
                Else
                    mtbVacDate.Text = ""
                End If
                ExpDate = CDate(lsvTags.Items(e.ItemIndex).SubItems(2).Text.ToString)
                If Not CDate(lsvTags.Items(e.ItemIndex).SubItems(2).Text) = #1/1/1900# Then
                    ;DateToStr = CDate(lsvTags.Items(e.ItemIndex).SubItems(2).Text).ToShortDateString
                    ;DateToStr1 = Mid(DateToStr, 1, Len(DateToStr) - 5)
                    Select Case Len(DateToStr1)
                        Case 3
                            ;DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & "0" & Mid(DateToStr1, 3, 1)
                        Case 4
                            If Mid(DateToStr1, 2, 1) = "/" Then
                                ;DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & Mid(DateToStr1, 3, 2)
                            Else
                                ;DateToStr1 = Mid(DateToStr1, 1, 2) & "0" & Mid(DateToStr1, 4, 1)
                            End If
                        Case 5
                            ;DateToStr1 = Mid(DateToStr1, 1, 2) & Mid(DateToStr1, 4, 2)
                    End Select
                    ;DateToStr = DateToStr1 & Mid(DateToStr, Len(DateToStr) - 3, 4)
                    mtbExpDate.Text = DateToStr
                Else
                    mtbExpDate.Text = ""
                End If
                If Not Trim(lsvTags.Items(e.ItemIndex).SubItems(8).Text) = "" Then
                    If Not CDate(lsvTags.Items(e.ItemIndex).SubItems(8).Text) = #1/1/1900# Then
                        ;DateToStr = CDate(lsvTags.Items(e.ItemIndex).SubItems(8).Text).ToShortDateString
                        ;DateToStr1 = Mid(DateToStr, 1, Len(DateToStr) - 5)
                        Select Case Len(DateToStr1)
                            Case 3
                                ;DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & "0" & Mid(DateToStr1, 3, 1)
                            Case 4
                                If Mid(DateToStr1, 2, 1) = "/" Then
                                    ;DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & Mid(DateToStr1, 3, 2)
                                Else
                                    ;DateToStr1 = Mid(DateToStr1, 1, 2) & "0" & Mid(DateToStr1, 4, 1)
                                End If
                            Case 5
                                ;DateToStr1 = Mid(DateToStr1, 1, 2) & Mid(DateToStr1, 4, 2)
                        End Select
                        ;DateToStr = DateToStr1 & Mid(DateToStr, Len(DateToStr) - 3, 4)
                        mtbDueDate.Text = DateToStr
                    Else
                        mtbDueDate.Text = ""
                    End If
                Else
                    mtbDueDate.Text = ""
                End If
                If Not Trim(lsvTags.Items(e.ItemIndex).SubItems(11).Text) = "" Then
                    If Not CDate(lsvTags.Items(e.ItemIndex).SubItems(11).Text) = #1/1/1900# Then
                        ;DateToStr = CDate(lsvTags.Items(e.ItemIndex).SubItems(11).Text).ToShortDateString
                        ;DateToStr1 = Mid(DateToStr, 1, Len(DateToStr) - 5)
                        Select Case Len(DateToStr1)
                            Case 3
                                ;DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & "0" & Mid(DateToStr1, 3, 1)
                            Case 4
                                If Mid(DateToStr1, 2, 1) = "/" Then
                                    ;DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & Mid(DateToStr1, 3, 2)
                                Else
                                    ;DateToStr1 = Mid(DateToStr1, 1, 2) & "0" & Mid(DateToStr1, 4, 1)
                                End If
                            Case 5
                                ;DateToStr1 = Mid(DateToStr1, 1, 2) & Mid(DateToStr1, 4, 2)
                        End Select
                        ;DateToStr = DateToStr1 & Mid(DateToStr, Len(DateToStr) - 3, 4)
                        mtbPayDate.Text = DateToStr
                    Else
                        mtbPayDate.Text = ""
                    End If
                Else
                    mtbPayDate.Text = ""
                End If
                If Trim(lsvTags.Items(e.ItemIndex).SubItems(3).Text) = "" Then
                    cmbChargeType.SelectedIndex = -1
                Else
                    cmbChargeType.Text = lsvTags.Items(e.ItemIndex).SubItems(3).Text
                End If
                txtChargeAmount.Text = lsvTags.Items(e.ItemIndex).SubItems(4).Text
                chkLetterSent.Checked = IIf(lsvTags.Items(e.ItemIndex).SubItems(9).Text = "Y", True, False)
                chkWalkIn.Checked = IIf(lsvTags.Items(e.ItemIndex).SubItems(10).Text = "Y", True, False)
                txtYear.Text = lsvTags.Items(e.ItemIndex).SubItems(7).Text
                txtLicense.Text = lsvTags.Items(e.ItemIndex).SubItems(6).Text
                If Trim(lsvTags.Items(e.ItemIndex).SubItems(12).Text) = "" Then
                    cmbPurchased.SelectedIndex = -1
                Else
                    cmbPurchased.Text = lsvTags.Items(e.ItemIndex).SubItems(12).Text
                End If
                txtCashier.Text = lsvTags.Items(e.ItemIndex).SubItems(13).Text
                For i = 0 To PaymentArray.Length - 1
                    If Trim(PaymentArray(i).PmntName) = lsvTags.Items(e.ItemIndex).SubItems(14).Text Then
                        Exit For
                    End If
                Next
                If i = PaymentArray.Length Then
                    cmbPmntType.SelectedIndex = -1
                Else
                    cmbPmntType.SelectedIndex = i
                End If
                txtCheckNo.Text = lsvTags.Items(e.ItemIndex).SubItems(15).Text
                expired = lsvTags.Items(e.ItemIndex).SubItems(16).Text
                If Not expired = "0" Then
                    lblExpired.Visible = True
                    If expired = "1" Then
                        lblExpired.Text = "THIS VACCINATION EXPIRED BASED ON VACCINATION DATE"
                    Else
                        lblExpired.Text = "THIS VACCINATION EXPIRED DUE TO NEW VACCINATION ADDED"
                    End If
                Else
                    lblExpired.Visible = False
                End If
                VacID = CInt(lsvTags.Items(e.ItemIndex).SubItems(17).Text)
            End If
        End If
    End Sub

    Sub Enable_Owner(ByVal Switch As Boolean)
        btnFind.Enabled = Not Switch
        btnExit.Enabled = Not Switch
        cmbState.Enabled = Switch
        cmdFirst.Enabled = Not (Switch Or BeginOfFile)
        cmdPrior.Enabled = Not (Switch Or BeginOfFile)
        cmdNext.Enabled = Not (Switch Or EndOfFile)
        cmdLast.Enabled = Not (Switch Or EndOfFile)
        cmdOrder.Enabled = Not Switch
        cmdDeleteOwner.Enabled = Not Switch
        rtbComments.Enabled = Switch
        txtAddr_pgeOwners.Enabled = Switch
        txtAddr2_pgeOwners.Enabled = Switch
        txtCity.Enabled = Switch
        txtOwner_pgeOwners.Enabled = Switch
        txtPhone1.Enabled = Switch
        txtPhone2.Enabled = Switch
        txtZIP.Enabled = Switch
    End Sub

    Sub Enable_Dogs(ByVal Switch As Boolean)
        btnExit.Enabled = Not Switch
        btnFind.Enabled = Not Switch
        chkRemoved.Enabled = Switch
        cmbSpecies.Enabled = Switch
        cmdDeleteDog.Enabled = Not Switch
        cmdReassign.Enabled = Not Switch
        cmdUpdateID.Enabled = Not Switch
        mtbBirthday.Enabled = Switch
        txtBreed_pgeDogs.Enabled = Switch
        txtColor.Enabled = Switch
        txtDogName_pgeDogs.Enabled = Switch
        txtReason.Enabled = Switch
        txtSex.Enabled = Switch
        txtWeight.Enabled = Switch
        lsvDogs.Enabled = Not Switch
    End Sub

    Sub Enable_Vaccination(ByVal Switch As Boolean)
        ;Dim VacExpDates As Boolean = False
        If AddMode = True Or UserLevel = 3 Then
            VacExpDates = True
        End If
        btnExit.Enabled = Not Switch
        btnFind.Enabled = Not Switch
        chkWalkIn.Enabled = Switch
        cmbChargeType.Enabled = Switch
        cmbClinics.Enabled = Switch
        cmbPmntType.Enabled = Switch
        cmbPurchased.Enabled = Switch
        cmdCopyVaccination.Enabled = Not Switch
        cmdDeleteVac.Enabled = Not Switch
        cmdPrint.Enabled = Not Switch
        cmdPrintAppl.Enabled = Not Switch
        cmdRedirect.Enabled = Not Switch
        cmdRemoveExpired.Enabled = Not Switch And (UserLevel = 3)
        txtCashier.Enabled = Switch
        txtCheckNo.Enabled = Switch
        mtbExpDate.Enabled = Switch And VacExpDates
        txtLicense.Enabled = Switch
        mtbPayDate.Enabled = Switch
        txtTagNumber.Enabled = Switch
        mtbVacDate.Enabled = Switch And VacExpDates
        lsvTags.Enabled = Not Switch
    End Sub

Imports System.Data
Imports System.Data.OleDb
Public Class frmDCLSelectOwner
    ;Dim ColNumber As Int16
    ;Dim OldInd As Int16
    ;Dim results As SqlClient.SqlDataReader
    ;Dim FindRow As DataRow

    Private Sub frmDCLSelectOwner_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        FindLastID()
        OldInd = OwnerInd
        Order = "Name"
        ;DisplayAll()
        txtFindOwner.Text = ""
        txtFindOwner.Focus()
    End Sub

    Sub DisplayAll()
        ;Dim OrderField As String = IIf(Order = "Name", "Customer", "ClientID";)
        connAdapter.SelectCommand.CommandText = "Select Customer, ClientID from " & OwnersTable & " Order By " & OrderField
        If Not dsDCL.Tables(";DogOwners";) Is Nothing Then
            dsDCL.Tables(";DogOwners";).Clear()
        End If
        connAdapter.Fill(dsDCL, ";DogOwners";)
        ;DataGridView1.DataSource = dsDCL.Tables(";DogOwners";)
        ;DataGridView1.Columns(0).Width = 300
    End Sub

    Private Sub btnContinue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnContinue.Click
        SelectID(DataGridView1.CurrentCell.RowIndex)
    End Sub
    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        SelectID(OldInd)
    End Sub

    Private Sub DataGridView1_ColumnHeaderMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.ColumnHeaderMouseClick
        If e.ColumnIndex = 0 Then
            Order = "Name"
            ;DisplayAll()
        Else
            Order = "ID"
            ;DisplayAll()
        End If
        ColNumber = e.ColumnIndex
        txtFindOwner.Text = ""
        txtFindOwner.Focus()
    End Sub

    Private Sub DataGridView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.DoubleClick
        SelectID(DataGridView1.CurrentCell.RowIndex)
    End Sub

    Private Sub DataGridView1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles DataGridView1.KeyPress
        If e.KeyChar = ChrW(Keys.Back) Then
            indRowNumber = 0
        Else
            txtFindOwner.Text &= txtFindOwner.Text & e.KeyChar
        End If
    End Sub

    Private Sub DataGridView1_RowLeave(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.RowLeave
    End Sub

    Private Sub txtFindOwner_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtFindOwner.KeyPress
        If e.KeyChar = ChrW(Keys.Back) Then
            indRowNumber = 0
        End If
        If e.KeyChar = ChrW(Keys.Return) Then
            SelectID(DataGridView1.CurrentCell.RowIndex)
        End If
    End Sub

    Private Sub txtFindOwner_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles txtFindOwner.MouseClick
        If Len(txtFindOwner.Text) = 0 Then
            indRowNumber = 0
        End If
    End Sub

    Private Sub txtFindOwner_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtFindOwner.TextChanged
        ;Dim blnfound As Boolean = False
        ;Dim i As Integer = 0
        ;Dim datastring As String = ""

        If Len(Trim(txtFindOwner.Text)) = 0 Then
            Exit Sub
        End If
        While indRowNumber <= DataGridView1.Rows.Count - 1
            datastring = DataGridView1.Rows(indRowNumber).Cells(ColNumber).Value
            If UCase(Mid(datastring, 1, Len(txtFindOwner.Text))) = UCase(txtFindOwner.Text) Then
                Customer = DataGridView1.Rows(indRowNumber).Cells(0).Value
                ClientID = DataGridView1.Rows(indRowNumber).Cells(1).Value
                OwnerInd = indRowNumber
                ;DataGridView1.Rows(indRowNumber).Selected = True
                ;DataGridView1.CurrentCell = DataGridView1.Rows(indRowNumber).Cells(ColNumber)
                blnfound = True
                Exit While
            End If
            indRowNumber += 1
        End While
        If blnfound = False Then
            MsgBox("Owners Name " & StrConv(txtFindOwner.Text, VbStrConv.ProperCase) & " Not On File";)
            indRowNumber = 0
            txtFindOwner.Text = Mid(txtFindOwner.Text, 1, Len(txtFindOwner.Text) - 1)
        Else
            OwnerInd = indRowNumber
        End If
    End Sub

    Sub SelectID(ByVal NewInd)
        OwnerInd = NewInd
        indRowNumber = OwnerInd
        Customer = DataGridView1.Rows(indRowNumber).Cells(0).Value
        ClientID = DataGridView1.Rows(indRowNumber).Cells(1).Value
        Me.Close()
    End Sub
End Class

Ответить

Номер ответа: 18
Автор ответа:
 



Вопросов: 1
Ответов: 26
 Профиль | | #18 Добавлено: 03.09.10 15:22
  1. Imports System.Data
  2. Imports System.Data.OleDb
  3. Imports System.Data.SqlClient
  4. Imports System.IO
  5.  
  6. Module modDogLicense
  7.     Public connString As String = "Data Source=SqlSrvSqlSrv; Initial Catalog=DogLicense; Integrated Security=SSPI;"
  8.     Dim QueryDCL As String
  9.     Public connDCL As New SqlConnection(connString)
  10.     Public connOwner As New SqlConnection(connString)
  11.     Public connAdapter As New SqlDataAdapter(QueryDCL, connDCL)
  12.     Public dsDCL As New DataSet
  13.     Public drRow As DataRow
  14.     Public drRowDogs As DataRow
  15.     Public drRowVac As DataRow
  16.     Public indRowNumber As Integer
  17.     Public SqlCommand As New SqlCommand
  18.     Public AddMode As Boolean
  19.     Public ClientID As String = ""
  20.     Public ClientTable As String
  21.     Public DataBase As String
  22.     Public DogID As String
  23.     Public DogsTable As String
  24.     Public EditMode As Boolean
  25.     Public Order As String
  26.     Public OwnerInd As Int16
  27.     Public OwnersTable As String
  28.     Public SqlStatement As String
  29.     Public VaccinationTable As String
  30.     Public VacID As Integer
  31.  
  32.    Sub Main()
  33.         DataBase = "Live"
  34.         OwnersTable = "DCLDogOwners"
  35.         DogsTable = "DCLDogs"
  36.         VaccinationTable = "DCLVaccination"
  37.         SqlCommand.Connection = connDCL
  38.         connDCL.Open()
  39.     End Sub
  40.  
  41. Public Class frmDCLMain
  42.  
  43.     Private Sub DogLicensesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DogLicensesToolStripMenuItem.Click
  44.         frmDogsAndCats.ShowDialog()
  45.     End Sub
  46.  
  47.    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
  48.         Me.Close()
  49.     End Sub
  50.  
  51.    Private Sub frmDCLMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  52.         Main()
  53.     End Sub
  54.  
  55. Public Class frmDogsAndCats
  56.     Dim litem As ListViewItem
  57.     Dim expired As String = "0"
  58.     Dim SelDog As Int16
  59.     Dim SqlStatementSecur As String
  60.     Dim VacInd As Integer
  61.  
  62.     Private Sub frmDogsAndCats_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  63.         ClientID = "030018"
  64.         Enable_Owner(False)
  65.         DisplayOwner()
  66.     End Sub
  67.  
  68.     Sub DisplayOwner()
  69.         SqlStatement = "Select * from " & OwnersTable & " Where clientid = '" & ClientID & "'"
  70.         connAdapter.SelectCommand.CommandText = SqlStatement
  71.         If Not dsDCL.Tables("SelectedOwner") Is Nothing Then
  72.             dsDCL.Tables("SelectedOwner").Clear()
  73.         End If
  74.         connAdapter.SelectCommand.CommandType = CommandType.Text
  75.         connAdapter.Fill(dsDCL, "SelectedOwner")
  76.         drRow = dsDCL.Tables("SelectedOwner").Rows(0)
  77.         txtClientID_pgeOwners.Text = ClientID
  78.         txtOwner_pgeOwners.Text = Trim(drRow.Item("Customer") & " ")
  79.         Customer = txtOwner_pgeOwners.Text
  80.         txtAddr_pgeOwners.Text = Trim(drRow.Item("Address1") & " ")
  81.         txtAddr2_pgeOwners.Text = Trim(drRow.Item("Address2") & " ")
  82.         txtCity.Text = Trim(drRow.Item("city") & " ")
  83.         txtZIP.Text = Trim(drRow.Item("zip") & " ")
  84.         cmbState.Text = Trim(drRow.Item("state") & " ")
  85.         txtPhone1.Text = Trim(drRow.Item("phone1") & " ")
  86.         txtPhone2.Text = Trim(drRow.Item("phone2") & " ")
  87.         If Not Trim(drRow.Item("paiddtd").ToString & " ") = "" Then
  88.             If Not CDate(Trim(drRow.Item("paiddtd").ToString & " ")) = #1/1/1990# Then
  89.                 txtPaidDate.Text = drRow.Item("paiddtd")
  90.             Else
  91.                 txtPaidDate.Text = ""
  92.             End If
  93.             txtPaidDate.Text = ""
  94.         End If
  95.         rtbComments.Text = Trim(drRow.Item("comments") & " ")
  96.         CityStateZIP = Trim(txtCity.Text) & ", " & cmbState.Text & " " & txtZIP.Text
  97.         cmdPrior.Enabled = True
  98.         cmdFirst.Enabled = True
  99.         cmdNext.Enabled = True
  100.         cmdLast.Enabled = True
  101.         BeginOfFile = False
  102.         EndOfFile = False
  103.         If OwnerInd = dsDCL.Tables("DogOwners").Rows.Count - 1 Then
  104.             cmdNext.Enabled = False
  105.             cmdLast.Enabled = False
  106.             EndOfFile = True
  107.         End If
  108.         If OwnerInd = 0 Then
  109.             cmdPrior.Enabled = False
  110.             cmdFirst.Enabled = False
  111.             BeginOfFile = True
  112.         End If
  113.         If Order = "Name" Then
  114.             cmdOrder.Text = "SWITCH TO ORDER BY CLIENT ID"
  115.         Else
  116.             cmdOrder.Text = "SWITCH TO ORDER BY CLIENT NAME"
  117.         End If
  118.         pgfDogsInfo.SelectedIndex = 0
  119.         pgeOwners.Select()
  120.     End Sub
  121.  
  122.     Sub DisplayDogs()
  123.         SqlStatement = "Select * from " & DogsTable & " Where clientid = '" & ClientID & "'"
  124.         SqlStatement &= " Order By Dog_ID"
  125.         connAdapter.SelectCommand.CommandText = SqlStatement
  126.         If Not dsDCL.Tables("SelectedDogs") Is Nothing Then
  127.             dsDCL.Tables("SelectedDogs").Clear()
  128.         End If
  129.         connAdapter.SelectCommand.CommandType = CommandType.Text
  130.         connAdapter.Fill(dsDCL, "SelectedDogs")
  131.         lsvDogs.Items.Clear()
  132.         If dsDCL.Tables("SelectedDogs").Rows.Count = 0 Then
  133.             litem = lsvDogs.Items.Add(" ")
  134.             litem.SubItems.Add("No Dogs On File For This Owner")
  135.             litem.SubItems.Add(" ")
  136.             litem.SubItems.Add(" ")
  137.             litem.SubItems.Add(" ")
  138.             litem.SubItems.Add(" ")
  139.             litem.SubItems.Add(" ")
  140.             litem.SubItems.Add(" ")
  141.             litem.SubItems.Add(" ")
  142.             litem.SubItems.Add(" ")
  143.             SelDog = 0
  144.         Else
  145.             Dim rowcount As Int16 = dsDCL.Tables("SelectedDogs").Rows.Count
  146.             Dim rowi As Int16 = 0
  147.             For Each drRowDogs In dsDCL.Tables("SelectedDogs").Rows
  148.                 litem = lsvDogs.Items.Add(drRowDogs.Item("Dog_ID"))
  149.                 litem.SubItems.Add(drRowDogs.Item("FullName"))
  150.                 litem.SubItems.Add(drRowDogs.Item("Breed"))
  151.                 litem.SubItems.Add(drRowDogs.Item("Gender"))
  152.                 litem.SubItems.Add(drRowDogs.Item("Dog_Color"))
  153.                 litem.SubItems.Add(drRowDogs.Item("Birthday").ToString)
  154.                 litem.SubItems.Add(drRowDogs.Item("Species"))
  155.                 litem.SubItems.Add(drRowDogs.Item("Weight"))
  156.                 litem.SubItems.Add(drRowDogs.Item("Deprived"))
  157.                 litem.SubItems.Add(drRowDogs.Item("Reason"))
  158.             Next
  159.             If AddMode = True Then
  160.                 SelDog = rowcount - 1
  161.             ElseIf EditMode = False Then
  162.                 SelDog = 0
  163.             End If
  164.         End If
  165.         txtClientID_pgeDogs.Text = txtClientID_pgeOwners.Text
  166.         txtOwner_pgeDogs.Text = txtOwner_pgeOwners.Text
  167.         txtAddr_pgeDogs.Text = txtAddr_pgeOwners.Text
  168.         txtAddr2_pgeDogs.Text = txtAddr2_pgeOwners.Text
  169.         lsvDogs.Items(SelDog).ListView.Select()
  170.         lsvDogs.Items(SelDog).Selected = True
  171.     End Sub
  172.  
  173.     Sub DisplayVaccination(ByVal VacID_Ind As Integer)
  174.         SqlStatement = "Select * from " & VaccinationTable & " Where clientid = '" & ClientID
  175.         SqlStatement &= "' AND dog_id = '" & DogID & "' Order By ClientID, Dog_ID, vacdate, expdate, vacid"
  176.         connAdapter.SelectCommand.CommandText = SqlStatement
  177.         If Not dsDCL.Tables("VaccinationTable") Is Nothing Then
  178.             dsDCL.Tables("VaccinationTable").Clear()
  179.         End If
  180.         connAdapter.SelectCommand.CommandType = CommandType.Text
  181.         connAdapter.Fill(dsDCL, "VaccinationTable")
  182.         lsvTags.Items.Clear()
  183.         VacInd = 0
  184.         If dsDCL.Tables("VaccinationTable").Rows.Count = 0 Then
  185.             litem = lsvTags.Items.Add(" ")
  186.             litem.SubItems.Add(" ")
  187.             litem.SubItems.Add(" ")
  188.             litem.SubItems.Add("No Vaccinations On File For This Dog/Cat")
  189.             litem.SubItems.Add(0)
  190.             litem.SubItems.Add(" ")
  191.             litem.SubItems.Add(" ")
  192.             litem.SubItems.Add(" ")
  193.             litem.SubItems.Add(" ")
  194.             litem.SubItems.Add(" ")
  195.             litem.SubItems.Add(" ")
  196.             litem.SubItems.Add(" ")
  197.             litem.SubItems.Add(" ")
  198.             litem.SubItems.Add(" ")
  199.             litem.SubItems.Add(" ")
  200.             litem.SubItems.Add(" ")
  201.             litem.SubItems.Add(" ")
  202.             litem.SubItems.Add(0)
  203.         Else
  204.             Dim test_str As Date
  205.             Dim test_decimal As Decimal = 0.0
  206.             Dim rowcount As Int16 = dsDCL.Tables("VaccinationTable").Rows.Count
  207.             Dim rowi As Int16 = 0
  208.             Dim i As Int16 = 0
  209.             For Each drRow In dsDCL.Tables("VaccinationTable").Rows
  210.                 litem = lsvTags.Items.Add(drRow.Item("TagNumber"))
  211.                 test_str = drRow.Item("VacDate")
  212.                 litem.SubItems.Add(test_str.ToShortDateString)
  213.                 test_str = drRow.Item("ExpDate")
  214.                 litem.SubItems.Add(test_str.ToShortDateString)
  215.                 litem.SubItems.Add(drRow.Item("ChargeType"))
  216.                 litem.SubItems.Add(drRow.Item("Amount").ToString)
  217.                 litem.SubItems.Add(drRow.Item("ClinicName"))
  218.                 litem.SubItems.Add(Trim(drRow.Item("License") & " "))
  219.                 litem.SubItems.Add(drRow.Item("For_Year"))
  220.                 If Trim(drRow.Item("DueDate").ToString & " ") = "" Then
  221.                     litem.SubItems.Add(" ")
  222.                 Else
  223.                     test_str = drRow.Item("DueDate")
  224.                     litem.SubItems.Add(test_str.ToShortDateString)
  225.                 End If
  226.                 litem.SubItems.Add(drRow.Item("LetterSent"))
  227.                 litem.SubItems.Add(Trim(drRow.Item("walkin") & " "))
  228.                 test_str = drRow.Item("PayDate")
  229.                 litem.SubItems.Add(test_str.ToShortDateString)
  230.                 litem.SubItems.Add(Trim(drRow.Item("Purchased") & " "))
  231.                 litem.SubItems.Add(Trim(drRow.Item("Cashier") & " "))
  232.                 For rowi = 0 To PaymentArray.Length - 1
  233.                     If Trim(drRow.Item("PayType") & " ") = PaymentArray(rowi).PmntCode Then
  234.                         Exit For
  235.                     End If
  236.                 Next
  237.                 If rowi = PaymentArray.Length Or PaymentArray(rowi).PmntCode = "" Then
  238.                     litem.SubItems.Add(" ")
  239.                 Else
  240. litem.SubItems.Add(Trim(PaymentArray(rowi).PmntName))
  241.                 End If
  242.                 litem.SubItems.Add(Trim(drRow.Item("Check_no") & " "))
  243.                 litem.SubItems.Add(Trim(drRow.Item("Expired") & " "))
  244.                 litem.SubItems.Add(drRow.Item("VacID").ToString)
  245.                 If VacID_Ind > 0 And VacID_Ind = drRow.Item("VacID") Then
  246.                     VacInd = i
  247.                 End If
  248.                 i += 1
  249.             Next
  250.             If AddMode = True Then
  251.                 VacInd = rowcount - 1
  252.             End If
  253.         End If
  254.         txtClientID_pgeVaccination.Text = txtClientID_pgeOwners.Text
  255.         txtOwner_pgeVaccination.Text = txtOwner_pgeOwners.Text
  256.         txtAddr_pgeVaccination.Text = txtAddr_pgeOwners.Text
  257.         txtAddr2_pgeVaccination.Text = txtAddr2_pgeOwners.Text
  258.         txtDogID_pgeVaccination.Text = txtDogID_pgeDogs.Text
  259.         txtDogName_pgeVaccination.Text = txtDogName_pgeDogs.Text
  260.         txtBreed_pgeVaccination.Text = txtBreed_pgeDogs.Text
  261.         lsvTags.Items(VacInd).ListView.Select()
  262.         lsvTags.Items(VacInd).Selected = True
  263.     End Sub
  264.  
  265.     Private Sub pgfDogsInfo_Selected(ByVal sender As Object, ByVal e As System.Windows.Forms.TabControlEventArgs) Handles pgfDogsInfo.Selected
  266.         Select Case e.TabPageIndex
  267.             Case Is = 1
  268.                 If AddMode = True Or EditMode = True Then
  269.                     Enable_Dogs(True)
  270.                 Else
  271.                     Enable_Dogs(False)
  272.                 End If
  273.                 DisplayDogs()
  274.             Case Is = 2
  275.                 If AddMode = True Or EditMode = True Then
  276.                     Enable_Vaccination(True)
  277.                 Else
  278.                     Enable_Vaccination(False)
  279.                 End If
  280.                 DisplayVaccination(0)
  281.         End Select
  282.     End Sub
  283.  
  284.     Private Sub lsvDogs_ItemSelectionChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.ListViewItemSelectionChangedEventArgs) Handles lsvDogs.ItemSelectionChanged
  285.         Dim birthday_str As String
  286.         Dim birthday As String
  287.         Dim birthday_date As Date
  288.         If e.IsSelected = True Then
  289.             SelDog = e.ItemIndex
  290.             If dsDCL.Tables("SelectedDogs").Rows.Count = 0 Then
  291.                 DogID = ""
  292.                 txtDogID_pgeDogs.Text = ""
  293.                 txtDogName_pgeDogs.Text = ""
  294.                 txtBreed_pgeDogs.Text = ""
  295.                 txtSex.Text = ""
  296.                 txtColor.Text = ""
  297.                 cmbSpecies.SelectedIndex = -1
  298.                 txtWeight.Text = ""
  299.                 mtbBirthday.Text = ""
  300.                 txtReason.Text = ""
  301.                 chkRemoved.Checked = False
  302.             Else
  303.                 DogID = lsvDogs.Items(e.ItemIndex).Text
  304.                 txtDogID_pgeDogs.Text = lsvDogs.Items(e.ItemIndex).Text
  305.                 txtDogName_pgeDogs.Text = lsvDogs.Items(e.ItemIndex).SubItems(1).Text
  306.                 txtBreed_pgeDogs.Text = lsvDogs.Items(e.ItemIndex).SubItems(2).Text
  307.                 txtSex.Text = lsvDogs.Items(e.ItemIndex).SubItems(3).Text
  308.                 txtColor.Text = lsvDogs.Items(e.ItemIndex).SubItems(4).Text
  309.                 cmbSpecies.Text = lsvDogs.Items(e.ItemIndex).SubItems(6).Text
  310.                 txtWeight.Text = lsvDogs.Items(e.ItemIndex).SubItems(7).Text
  311.                 birthday = lsvDogs.Items(e.ItemIndex).SubItems(5).Text
  312.                 If Not Trim(birthday) = "" Then
  313.                     birthday_date = CDate(birthday)
  314.                     If Not birthday_date = #1/1/1900# Then
  315.                         birthday = birthday_date.ToShortDateString
  316.                         birthday_str = Mid(birthday, 1, Len(birthday) - 5)
  317.                         Select Case Len(birthday_str)
  318.                             Case 3
  319.                                 birthday_str = "0" & Mid(birthday_str, 1, 1) & "0" & Mid(birthday_str, 3, 1)
  320.                             Case 4
  321.                                 If Mid(birthday_str, 2, 1) = "/" Then
  322.                                     birthday_str = "0" & Mid(birthday_str, 1, 1) & Mid(birthday_str, 3, 2)
  323.                                 Else
  324.                                     birthday_str = Mid(birthday_str, 1, 2) & "0" & Mid(birthday_str, 4, 1)
  325.                                 End If
  326.                             Case 5
  327.                                 birthday_str = Mid(birthday_str, 1, 2) & Mid(birthday_str, 4, 2)
  328.                         End Select
  329.                         birthday = birthday_str & Mid(birthday, Len(birthday) - 3, 4)
  330.                         mtbBirthday.Text = birthday
  331.                     Else
  332.                         mtbBirthday.Text = ""
  333.                     End If
  334.                 End If
  335.                 txtReason.Text = lsvDogs.Items(e.ItemIndex).SubItems(9).Text
  336.                 chkRemoved.Checked = IIf(lsvDogs.Items(e.ItemIndex).SubItems(8).Text = "Y", True, False)
  337.             End If
  338.         End If
  339.     End Sub
  340.  
  341.     Private Sub lsvTags_ItemSelectionChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.ListViewItemSelectionChangedEventArgs) Handles lsvTags.ItemSelectionChanged
  342.         Dim i As Int16
  343.         Dim DateToStr As String
  344.         Dim DateToStr1 As String
  345.         If e.IsSelected = True Then
  346.             VacInd = e.ItemIndex
  347.             If dsDCL.Tables("VaccinationTable").Rows.Count = 0 Then
  348.                 txtTagNumber.Text = ""
  349.                 cmbClinics.SelectedIndex = -1
  350.                 mtbVacDate.Text = ""
  351.                 mtbExpDate.Text = ""
  352.                 mtbDueDate.Text = ""
  353.                 mtbPayDate.Text = ""
  354.                 cmbChargeType.SelectedIndex = -1
  355.                 txtChargeAmount.Text = ""
  356.                 chkLetterSent.Checked = False
  357.                 chkWalkIn.Checked = False
  358.                 txtYear.Text = ""
  359.                 txtLicense.Text = ""
  360.                 cmbPurchased.SelectedIndex = -1
  361.                 txtCashier.Text = ""
  362.                 cmbPmntType.SelectedIndex = -1
  363.                 txtCheckNo.Text = ""
  364.                 expired = "0"
  365.                 VacID = 0
  366.             Else
  367.                 txtTagNumber.Text = lsvTags.Items(e.ItemIndex).Text
  368.                 If Trim(lsvTags.Items(e.ItemIndex).SubItems(5).Text) = "" Then
  369.                     cmbClinics.SelectedIndex = -1
  370.                 Else
  371.                     cmbClinics.Text = lsvTags.Items(e.ItemIndex).SubItems(5).Text
  372.                 End If
  373.                 VacDate = CDate(lsvTags.Items(e.ItemIndex).SubItems(1).Text.ToString)
  374.                 If Not CDate(lsvTags.Items(e.ItemIndex).SubItems(1).Text) = #1/1/1900# Then
  375.                     DateToStr = CDate(lsvTags.Items(e.ItemIndex).SubItems(1).Text).ToShortDateString
  376.                     DateToStr1 = Mid(DateToStr, 1, Len(DateToStr) - 5)
  377.                     Select Case Len(DateToStr1)
  378.                         Case 3
  379.                             DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & "0" & Mid(DateToStr1, 3, 1)
  380.                         Case 4
  381.                             If Mid(DateToStr1, 2, 1) = "/" Then
  382.                                 DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & Mid(DateToStr1, 3, 2)
  383.                             Else
  384.                                 DateToStr1 = Mid(DateToStr1, 1, 2) & "0" & Mid(DateToStr1, 4, 1)
  385.                             End If
  386.                         Case 5
  387.                             DateToStr1 = Mid(DateToStr1, 1, 2) & Mid(DateToStr1, 4, 2)
  388.                     End Select
  389.                     DateToStr = DateToStr1 & Mid(DateToStr, Len(DateToStr) - 3, 4)
  390.                     mtbVacDate.Text = DateToStr
  391.                 Else
  392.                     mtbVacDate.Text = ""
  393.                 End If
  394.                 ExpDate = CDate(lsvTags.Items(e.ItemIndex).SubItems(2).Text.ToString)
  395.                 If Not CDate(lsvTags.Items(e.ItemIndex).SubItems(2).Text) = #1/1/1900# Then
  396.                     DateToStr = CDate(lsvTags.Items(e.ItemIndex).SubItems(2).Text).ToShortDateString
  397.                     DateToStr1 = Mid(DateToStr, 1, Len(DateToStr) - 5)
  398.                     Select Case Len(DateToStr1)
  399.                         Case 3
  400.                             DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & "0" & Mid(DateToStr1, 3, 1)
  401.                         Case 4
  402.                             If Mid(DateToStr1, 2, 1) = "/" Then
  403.                                 DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & Mid(DateToStr1, 3, 2)
  404.                             Else
  405.                                 DateToStr1 = Mid(DateToStr1, 1, 2) & "0" & Mid(DateToStr1, 4, 1)
  406.                             End If
  407.                         Case 5
  408.                             DateToStr1 = Mid(DateToStr1, 1, 2) & Mid(DateToStr1, 4, 2)
  409.                     End Select
  410.                     DateToStr = DateToStr1 & Mid(DateToStr, Len(DateToStr) - 3, 4)
  411.                     mtbExpDate.Text = DateToStr
  412.                 Else
  413.                     mtbExpDate.Text = ""
  414.                 End If
  415.                 If Not Trim(lsvTags.Items(e.ItemIndex).SubItems(8).Text) = "" Then
  416.                     If Not CDate(lsvTags.Items(e.ItemIndex).SubItems(8).Text) = #1/1/1900# Then
  417.                         DateToStr = CDate(lsvTags.Items(e.ItemIndex).SubItems(8).Text).ToShortDateString
  418.                         DateToStr1 = Mid(DateToStr, 1, Len(DateToStr) - 5)
  419.                         Select Case Len(DateToStr1)
  420.                             Case 3
  421.                                 DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & "0" & Mid(DateToStr1, 3, 1)
  422.                             Case 4
  423.                                 If Mid(DateToStr1, 2, 1) = "/" Then
  424.                                     DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & Mid(DateToStr1, 3, 2)
  425.                                 Else
  426.                                     DateToStr1 = Mid(DateToStr1, 1, 2) & "0" & Mid(DateToStr1, 4, 1)
  427.                                 End If
  428.                             Case 5
  429.                                 DateToStr1 = Mid(DateToStr1, 1, 2) & Mid(DateToStr1, 4, 2)
  430.                         End Select
  431.                         DateToStr = DateToStr1 & Mid(DateToStr, Len(DateToStr) - 3, 4)
  432.                         mtbDueDate.Text = DateToStr
  433.                     Else
  434.                         mtbDueDate.Text = ""
  435.                     End If
  436.                 Else
  437.                     mtbDueDate.Text = ""
  438.                 End If
  439.                 If Not Trim(lsvTags.Items(e.ItemIndex).SubItems(11).Text) = "" Then
  440.                     If Not CDate(lsvTags.Items(e.ItemIndex).SubItems(11).Text) = #1/1/1900# Then
  441.                         DateToStr = CDate(lsvTags.Items(e.ItemIndex).SubItems(11).Text).ToShortDateString
  442.                         DateToStr1 = Mid(DateToStr, 1, Len(DateToStr) - 5)
  443.                         Select Case Len(DateToStr1)
  444.                             Case 3
  445.                                 DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & "0" & Mid(DateToStr1, 3, 1)
  446.                             Case 4
  447.                                 If Mid(DateToStr1, 2, 1) = "/" Then
  448.                                     DateToStr1 = "0" & Mid(DateToStr1, 1, 1) & Mid(DateToStr1, 3, 2)
  449.                                 Else
  450.                                     DateToStr1 = Mid(DateToStr1, 1, 2) & "0" & Mid(DateToStr1, 4, 1)
  451.                                 End If
  452.                             Case 5
  453.                                 DateToStr1 = Mid(DateToStr1, 1, 2) & Mid(DateToStr1, 4, 2)
  454.                         End Select
  455.                         DateToStr = DateToStr1 & Mid(DateToStr, Len(DateToStr) - 3, 4)
  456.                         mtbPayDate.Text = DateToStr
  457.                     Else
  458.                         mtbPayDate.Text = ""
  459.                     End If
  460.                 Else
  461.                     mtbPayDate.Text = ""
  462.                 End If
  463.                 If Trim(lsvTags.Items(e.ItemIndex).SubItems(3).Text) = "" Then
  464.                     cmbChargeType.SelectedIndex = -1
  465.                 Else
  466.                     cmbChargeType.Text = lsvTags.Items(e.ItemIndex).SubItems(3).Text
  467.                 End If
  468.                 txtChargeAmount.Text = lsvTags.Items(e.ItemIndex).SubItems(4).Text
  469.                 chkLetterSent.Checked = IIf(lsvTags.Items(e.ItemIndex).SubItems(9).Text = "Y", True, False)
  470.                 chkWalkIn.Checked = IIf(lsvTags.Items(e.ItemIndex).SubItems(10).Text = "Y", True, False)
  471.                 txtYear.Text = lsvTags.Items(e.ItemIndex).SubItems(7).Text
  472.                 txtLicense.Text = lsvTags.Items(e.ItemIndex).SubItems(6).Text
  473.                 If Trim(lsvTags.Items(e.ItemIndex).SubItems(12).Text) = "" Then
  474.                     cmbPurchased.SelectedIndex = -1
  475.                 Else
  476.                     cmbPurchased.Text = lsvTags.Items(e.ItemIndex).SubItems(12).Text
  477.                 End If
  478.                 txtCashier.Text = lsvTags.Items(e.ItemIndex).SubItems(13).Text
  479.                 For i = 0 To PaymentArray.Length - 1
  480.                     If Trim(PaymentArray(i).PmntName) = lsvTags.Items(e.ItemIndex).SubItems(14).Text Then
  481.                         Exit For
  482.                     End If
  483.                 Next
  484.                 If i = PaymentArray.Length Then
  485.                     cmbPmntType.SelectedIndex = -1
  486.                 Else
  487.                     cmbPmntType.SelectedIndex = i
  488.                 End If
  489.                 txtCheckNo.Text = lsvTags.Items(e.ItemIndex).SubItems(15).Text
  490.                 expired = lsvTags.Items(e.ItemIndex).SubItems(16).Text
  491.                 If Not expired = "0" Then
  492.                     lblExpired.Visible = True
  493.                     If expired = "1" Then
  494.                         lblExpired.Text = "THIS  VACCINATION  EXPIRED  BASED  ON  VACCINATION  DATE"
  495.                     Else
  496.                         lblExpired.Text = "THIS  VACCINATION  EXPIRED  DUE  TO  NEW  VACCINATION  ADDED"
  497.                     End If
  498.                 Else
  499.                     lblExpired.Visible = False
  500.                 End If
  501.                 VacID = CInt(lsvTags.Items(e.ItemIndex).SubItems(17).Text)
  502.             End If
  503.         End If
  504.     End Sub
  505.  
  506.     Sub Enable_Owner(ByVal Switch As Boolean)
  507.         btnFind.Enabled = Not Switch
  508.         btnExit.Enabled = Not Switch
  509.         cmbState.Enabled = Switch
  510.         cmdFirst.Enabled = Not (Switch Or BeginOfFile)
  511.         cmdPrior.Enabled = Not (Switch Or BeginOfFile)
  512.         cmdNext.Enabled = Not (Switch Or EndOfFile)
  513.         cmdLast.Enabled = Not (Switch Or EndOfFile)
  514.         cmdOrder.Enabled = Not Switch
  515.         cmdDeleteOwner.Enabled = Not Switch
  516.         rtbComments.Enabled = Switch
  517.         txtAddr_pgeOwners.Enabled = Switch
  518.         txtAddr2_pgeOwners.Enabled = Switch
  519.         txtCity.Enabled = Switch
  520.         txtOwner_pgeOwners.Enabled = Switch
  521.         txtPhone1.Enabled = Switch
  522.         txtPhone2.Enabled = Switch
  523.         txtZIP.Enabled = Switch
  524.     End Sub
  525.  
  526.     Sub Enable_Dogs(ByVal Switch As Boolean)
  527.         btnExit.Enabled = Not Switch
  528.         btnFind.Enabled = Not Switch
  529.         chkRemoved.Enabled = Switch
  530.         cmbSpecies.Enabled = Switch
  531.         cmdDeleteDog.Enabled = Not Switch
  532.         cmdReassign.Enabled = Not Switch
  533.         cmdUpdateID.Enabled = Not Switch
  534.         mtbBirthday.Enabled = Switch
  535.         txtBreed_pgeDogs.Enabled = Switch
  536.         txtColor.Enabled = Switch
  537.         txtDogName_pgeDogs.Enabled = Switch
  538.         txtReason.Enabled = Switch
  539.         txtSex.Enabled = Switch
  540.         txtWeight.Enabled = Switch
  541.         lsvDogs.Enabled = Not Switch
  542.     End Sub
  543.  
  544.     Sub Enable_Vaccination(ByVal Switch As Boolean)
  545.         Dim VacExpDates As Boolean = False
  546.         If AddMode = True Or UserLevel = 3 Then
  547.             VacExpDates = True
  548.         End If
  549.         btnExit.Enabled = Not Switch
  550.         btnFind.Enabled = Not Switch
  551.         chkWalkIn.Enabled = Switch
  552.         cmbChargeType.Enabled = Switch
  553.         cmbClinics.Enabled = Switch
  554.         cmbPmntType.Enabled = Switch
  555.         cmbPurchased.Enabled = Switch
  556.         cmdCopyVaccination.Enabled = Not Switch
  557.         cmdDeleteVac.Enabled = Not Switch
  558.         cmdPrint.Enabled = Not Switch
  559.         cmdPrintAppl.Enabled = Not Switch
  560.         cmdRedirect.Enabled = Not Switch
  561.         cmdRemoveExpired.Enabled = Not Switch And (UserLevel = 3)
  562.         txtCashier.Enabled = Switch
  563.         txtCheckNo.Enabled = Switch
  564.         mtbExpDate.Enabled = Switch And VacExpDates
  565.         txtLicense.Enabled = Switch
  566.         mtbPayDate.Enabled = Switch
  567.         txtTagNumber.Enabled = Switch
  568.         mtbVacDate.Enabled = Switch And VacExpDates
  569.         lsvTags.Enabled = Not Switch
  570.     End Sub
  571.  
  572. Imports System.Data
  573. Imports System.Data.OleDb
  574. Public Class frmDCLSelectOwner
  575.     Dim ColNumber As Int16
  576.     Dim OldInd As Int16
  577.     Dim results As SqlClient.SqlDataReader
  578.     Dim FindRow As DataRow
  579.  
  580.     Private Sub frmDCLSelectOwner_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  581.         FindLastID()
  582.         OldInd = OwnerInd
  583.         Order = "Name"
  584.         DisplayAll()
  585.         txtFindOwner.Text = ""
  586.         txtFindOwner.Focus()
  587.     End Sub
  588.  
  589.     Sub DisplayAll()
  590.         Dim OrderField As String = IIf(Order = "Name", "Customer", "ClientID")
  591.         connAdapter.SelectCommand.CommandText = "Select Customer, ClientID from " & OwnersTable & " Order By  " & OrderField
  592.         If Not dsDCL.Tables("DogOwners") Is Nothing Then
  593.             dsDCL.Tables("DogOwners").Clear()
  594.         End If
  595.         connAdapter.Fill(dsDCL, "DogOwners")
  596.         DataGridView1.DataSource = dsDCL.Tables("DogOwners")
  597.         DataGridView1.Columns(0).Width = 300
  598.     End Sub
  599.  
  600.     Private Sub btnContinue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnContinue.Click
  601.         SelectID(DataGridView1.CurrentCell.RowIndex)
  602.     End Sub
  603.     Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
  604.         SelectID(OldInd)
  605.     End Sub
  606.  
  607.     Private Sub DataGridView1_ColumnHeaderMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.ColumnHeaderMouseClick
  608.         If e.ColumnIndex = 0 Then
  609.             Order = "Name"
  610.             DisplayAll()
  611.         Else
  612.             Order = "ID"
  613.             DisplayAll()
  614.         End If
  615.         ColNumber = e.ColumnIndex
  616.         txtFindOwner.Text = ""
  617.         txtFindOwner.Focus()
  618.     End Sub
  619.  
  620.     Private Sub DataGridView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.DoubleClick
  621.         SelectID(DataGridView1.CurrentCell.RowIndex)
  622.     End Sub
  623.  
  624.     Private Sub DataGridView1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles DataGridView1.KeyPress
  625.         If e.KeyChar = ChrW(Keys.Back) Then
  626.             indRowNumber = 0
  627.         Else
  628.             txtFindOwner.Text &= txtFindOwner.Text & e.KeyChar
  629.         End If
  630.     End Sub
  631.  
  632.     Private Sub DataGridView1_RowLeave(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.RowLeave
  633.     End Sub
  634.  
  635.     Private Sub txtFindOwner_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtFindOwner.KeyPress
  636.         If e.KeyChar = ChrW(Keys.Back) Then
  637.             indRowNumber = 0
  638.         End If
  639.         If e.KeyChar = ChrW(Keys.Return) Then
  640.             SelectID(DataGridView1.CurrentCell.RowIndex)
  641.         End If
  642.     End Sub
  643.  
  644.     Private Sub txtFindOwner_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles txtFindOwner.MouseClick
  645.         If Len(txtFindOwner.Text) = 0 Then
  646.             indRowNumber = 0
  647.         End If
  648.     End Sub
  649.  
  650.     Private Sub txtFindOwner_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtFindOwner.TextChanged
  651.         Dim blnfound As Boolean = False
  652.         Dim i As Integer = 0
  653.         Dim datastring As String = ""
  654.  
  655.         If Len(Trim(txtFindOwner.Text)) = 0 Then
  656.             Exit Sub
  657.         End If
  658.         While indRowNumber <= DataGridView1.Rows.Count - 1
  659.             datastring = DataGridView1.Rows(indRowNumber).Cells(ColNumber).Value
  660.             If UCase(Mid(datastring, 1, Len(txtFindOwner.Text))) = UCase(txtFindOwner.Text) Then
  661.                 Customer = DataGridView1.Rows(indRowNumber).Cells(0).Value
  662.                 ClientID = DataGridView1.Rows(indRowNumber).Cells(1).Value
  663.                 OwnerInd = indRowNumber
  664.                 DataGridView1.Rows(indRowNumber).Selected = True
  665.                 DataGridView1.CurrentCell = DataGridView1.Rows(indRowNumber).Cells(ColNumber)
  666.                 blnfound = True
  667.                 Exit While
  668.             End If
  669.             indRowNumber += 1
  670.         End While
  671.         If blnfound = False Then
  672.             MsgBox("Owners Name " & StrConv(txtFindOwner.Text, VbStrConv.ProperCase) & " Not On File")
  673.             indRowNumber = 0
  674.             txtFindOwner.Text = Mid(txtFindOwner.Text, 1, Len(txtFindOwner.Text) - 1)
  675.         Else
  676.             OwnerInd = indRowNumber
  677.         End If
  678.     End Sub
  679.  
  680.     Sub SelectID(ByVal NewInd)
  681.         OwnerInd = NewInd
  682.         indRowNumber = OwnerInd
  683.         Customer = DataGridView1.Rows(indRowNumber).Cells(0).Value
  684.         ClientID = DataGridView1.Rows(indRowNumber).Cells(1).Value
  685.         Me.Close()
  686.     End Sub
  687. End Class

Ответить

Номер ответа: 19
Автор ответа:
 



Вопросов: 1
Ответов: 26
 Профиль | | #19 Добавлено: 03.09.10 15:24
Надеюсь, что сейчас всё должно быть нормально...
Извините за ошибки при копировании: у каждого форума свои "заморочки".

Ответить

Номер ответа: 20
Автор ответа:
 



Вопросов: 1
Ответов: 26
 Профиль | | #20 Добавлено: 08.09.10 19:46
Значит, помощи не будет?
Жаль...

Ответить

Номер ответа: 21
Автор ответа:
 EROS



Вопросов: 58
Ответов: 4255
 Профиль | | #21 Добавлено: 08.09.10 20:04
А вы предлагаете нам быстренько развернуть у себя на машине SQL SERVER, телепатическим способом узнать структуру вашей БД, быстренько создать у себя такую же.. Затем методом глубоко анализа вашего кода узнать какие вы используете контролы, затем создать у себя такие же, дать им такие же имена как у вас, после чего подключить все используемые вами обработчики событий.. Чтобы потом запустить проект и приступить к поиску косяка в портянке вашего кода? Не уж, увольте..
Фраза
показать уменьшенную копию проблемы

носила несколько другой смысл..

Ответить

Номер ответа: 22
Автор ответа:
 



Вопросов: 1
Ответов: 26
 Профиль | | #22 Добавлено: 08.09.10 20:26
Я не понял: Вы хотите, чтобы я каким-то образом переслал Вам все таблицы со всеми данными? То есть, всю БД?

Ответить

Номер ответа: 23
Автор ответа:
 



Вопросов: 1
Ответов: 26
 Профиль | | #23 Добавлено: 08.09.10 20:52
С контролами и формами проще. Если Вы дадите мне email адрес, я могу переслать две свои формы и модуль. Или это не принято?

Ответить

Номер ответа: 24
Автор ответа:
 EROS



Вопросов: 58
Ответов: 4255
 Профиль | | #24 Добавлено: 08.09.10 20:57
Iosif, чтоб однозначно понять в чем проблема надо иметь ваш код и подробное описание проблемы. Код, который вы выложили, слишком громозд и избыточен и вовсе не приспособлен для поиска проблемы без источника данных.. Вам предлагали создать тестовый проект, кинуть на форму ваш TabControl, создать вкладки, раскидать по ним ListView , заполнить их тестовыми/виртуальными данными (без использования БД) по 2-3 строчки и попытаться воспроизвести вашу проблему. При наличии таковой опубликовать этот проект на любом файловом хостинге и тут, на форуме, опубликовать ссылку на этот проект с описанием действий которые я, или кто то другой, должен проделать чтобы получить вашу проблему. Поймите правильно, из преложенного вами кода нам ничего не понять.. он не отражает суть проблемы.

Ответить

Номер ответа: 25
Автор ответа:
 



Вопросов: 1
Ответов: 26
 Профиль | | #25 Добавлено: 08.09.10 21:02
"Маленькая" проблема: я никогда не создавал хостинги и не знаю, как это делать...
В любом случае, спасибо за попытку мне помочь.
Остался только один вопрос: как мне удалить мой профиль с этого форума?

Ответить

Номер ответа: 26
Автор ответа:
 EROS



Вопросов: 58
Ответов: 4255
 Профиль | | #26 Добавлено: 08.09.10 21:10
Iosif, не надо обижаться.. люди тут, в большинстве своем, вполне адекватные.
Давайте, для начала, попробуем локализовать вашу проблему.. Попробуйте сделать следующее:
1. Запустите ваш проект
2. Проделайте ваши манипуляции с вкладками и перейдите на ту, в которой строка не подсвечивается
3. Затем ткните мышкой и попробуйте принудительно ее выделить..

Выделяется?

Ответить

Номер ответа: 27
Автор ответа:
 



Вопросов: 1
Ответов: 26
 Профиль | | #27 Добавлено: 08.09.10 21:14
Да, конечно.
Заметьте, пожалуйста, ещё одно моё замечание: не подсвечивается строка в сабе DisplayDogs(), а в DisplayVaccination() подсвечивается сразу, хотя оба сабрутина закнчиваются одной и той же командой.

Ответить

Номер ответа: 28
Автор ответа:
 EROS



Вопросов: 58
Ответов: 4255
 Профиль | | #28 Добавлено: 08.09.10 21:22
Отлично, значит проблема однозначно в фокусе..
Теперь попробуйте сделать следующее:
У TabControls Есть событие SelectedIndexChanged, оно срабатывает, когда вы меняете вкладку.. Попробуйте содать обработчик этого события в котором
Проверьте свойство TabControl1.SelectedIndex(нумерация начинается с 0) и если оно равно нужной вкладке ,допустим у вас это вкладка 2 то принудительно передайте фокус на ваш контрол фокус.. что то типа lsvDogs.Focus

Ответить

Номер ответа: 29
Автор ответа:
 



Вопросов: 1
Ответов: 26
 Профиль | | #29 Добавлено: 08.09.10 21:29
Извините, но если можете, назовите некоторые понятия по-английски. Например, что такое вкладка? TabPage? Под словом "обработчик" Вы подразумеваете Sub? А что такое "свойство"? Ещё раз прошу прощения за такие "глупые" вопросы.

Ответить

Номер ответа: 30
Автор ответа:
 EROS



Вопросов: 58
Ответов: 4255
 Профиль | | #30 Добавлено: 08.09.10 21:50
Да, вкладка это именно TabPage
Обработчик это процедура, которая вызывается в ответ на опреденное действие пользователя, например:
Процедура DogLicensesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DogLicensesToolStripMenuItem.Click вызывается в ответ на щелчок пользователя по пункту меню.. Это вы создали обработчик для события Click на пункте меню. Теперь по аналогии создайте обработчик для события SelectedIndexChanged вашего TabControl1 (или как он у вас называется)
Свойство... это .. эээ..мммм.. это свойство!! Это свойство объекта.. в вашем случае как пример: txtZIP.Text .. тут Text - Это свойство объекта txtZIP По аналогии у TabControl есть свойство SelectedIndex,которое показывает какая вкладка/TabPage (по номеру) сейчас активна

Ответить

Страница: 1 | 2 | 3 | 4 |

Поиск по форуму



© Copyright 2002-2011 VBNet.RU | Пишите нам