tzsxunit.cpp

来自「该软件为计算机公司进销存管理系统。方便公司管理人员对进货、出货和库存产品的管理和」· C++ 代码 · 共 92 行

CPP
92 行
字号
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "TzsxUnit.h"
#include "DModUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TTzsxForm *TzsxForm;
//---------------------------------------------------------------------------
__fastcall TTzsxForm::TTzsxForm(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TTzsxForm::BitBtn1Click(TObject *Sender)
{
    try
    {
        int i,j;
        for( i=1 ; i < ListBox1->Items->Count;i++){
            if (ListBox1->Selected[i]){
                for( j=i-1; j>= 0 ;j--)
                  if ( !ListBox1->Selected[j]){
                     TempString = ListBox1->Items->Strings[i];
                     ListBox1->Items->Strings[i] = ListBox1->Items->Strings[j];
                     ListBox1->Items->Strings[j] = TempString;
                     ListBox1->Selected[j] = True;
                     ListBox1->Selected[i] = False;
                     break;
                  }
            }
        }
    }
    catch(...)
    {
        ShowMessage("不能正确调整顺序");
    }
}
//---------------------------------------------------------------------------
void __fastcall TTzsxForm::BitBtn2Click(TObject *Sender)
{
    try
    {
        int i,j;
        for( i=ListBox1->Items->Count-2; i >= 0;i--){
            if (ListBox1->Selected[i]){
                for( j=i+1; j < ListBox1->Items->Count;j++)
                  if ( !ListBox1->Selected[j]){
                     TempString = ListBox1->Items->Strings[i];
                     ListBox1->Items->Strings[i] = ListBox1->Items->Strings[j];
                     ListBox1->Items->Strings[j] = TempString;
                     ListBox1->Selected[j] = True;
                     ListBox1->Selected[i] = False;
                     break;
                  }
            }
        }
    }
    catch(...)
    {
        ShowMessage("不能正确调整顺序");
    }
}
//---------------------------------------------------------------------------
void __fastcall TTzsxForm::Button4Click(TObject *Sender)
{
    Close();
}
//---------------------------------------------------------------------------
void __fastcall TTzsxForm::BitBtn3Click(TObject *Sender)
{
    try
    {
        AnsiString SQLStr;
        for(int i = 0; i < ListBox1->Count;i++){
            SQLStr = Format("update cpxxb set xh=%d where name ='%s'",
                        OPENARRAY(TVarRec,(i,ListBox1->Items->Strings[i])));
            DMod->ExecuteSQL(SQLStr,"不能正确写入序号");
        }
        Close();
    }
    catch(...)
    {
        ShowMessage("不能正确写入序号");
    }
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?