Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > IT форум > Помощь студентам
Регистрация

Восстановить пароль

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 31.05.2010, 19:18   #1
Fantss
 
Регистрация: 22.03.2010
Сообщений: 7
Восклицание Дынные из Combobox в переменную

Проблема такая:
В Комбобокс введены 7 компаний
Каждая компания должна иметь своё значение ,т.е
Amtel = 1253

примерно так...

Не пойму как из комбобокса вывести значение компание в переменную и присвоить ей значение 1253...

Fantss вне форума Ответить с цитированием
Старый 31.05.2010, 19:32   #2
Terran
Участник клуба
 
Аватар для Terran
 
Регистрация: 28.11.2007
Сообщений: 1,521
По умолчанию

Если я правильно понял, то вот:
Код:
Procedure TForm1.ComboBox1Change(Sender: TObject);
Var
S: String;
Begin
S:=ComboBox1.Text + ' = 1253';
Label1.Caption:=S;
End;
Всегда рад помочь!
Terran вне форума Ответить с цитированием
Старый 31.05.2010, 19:38   #3
Fantss
 
Регистрация: 22.03.2010
Сообщений: 7
По умолчанию

Там в одном комбобоксе 7 значений.... каждому из этих семи надо присвоить переменную... одна переменная будет равна одной сумме, другая другой и т.д
Fantss вне форума Ответить с цитированием
Старый 31.05.2010, 19:48   #4
Terran
Участник клуба
 
Аватар для Terran
 
Регистрация: 28.11.2007
Сообщений: 1,521
По умолчанию

Вот пару вариантов:
Код:
Procedure TForm1.ComboBox1Change(Sender: TObject);
Var
S: String;
I,I2,I3: Integer;//Переменные с суммой
Begin
Case ComboBox1.ItemIndex Of
0: S:=ComboBox1.Text + ' = ' + IntToStr(I);//1-ая компания
1: S:=ComboBox1.Text + ' = ' + IntToStr(I2);//2-ая компания
2: S:=ComboBox1.Text + ' = ' + IntToStr(I3);//3-ая компания
//и т.д.
End;
Label1.Caption:=S;
End;
//Вариант 2
Procedure TForm1.Button1Click(Sender: TObject);
Var
I,I2,I3: Integer;//Переменные с суммой
Begin
ComboBox1.Items.Strings[0]:=ComboBox1.Items.Strings[0] + ' = ' + IntToStr(I);
ComboBox1.Items.Strings[1]:=ComboBox1.Items.Strings[1] + ' = ' + IntToStr(I2);
ComboBox1.Items.Strings[2]:=ComboBox1.Items.Strings[2] + ' = ' + IntToStr(I3);
//и т.д.
End;
Выбирайте какой Вам будет удобнее.
Всегда рад помочь!
Terran вне форума Ответить с цитированием
Старый 31.05.2010, 22:01   #5
Fantss
 
Регистрация: 22.03.2010
Сообщений: 7
По умолчанию

блин(( ни одна помощь не помогла((

мне надо только чтобы название компании было равно переменной, а далее
я этой переменной присвою число!


Вот код программы с самого начала =) разбирайтесь =)


procedure TForm1.Edit1Change(Sender: TObject);
begin
TryStrToInt(edit1.text,i);
end;

procedure TForm1.CheckBox4Click(Sender: TObject);
begin
CheckBox4.Tag:=q;
q:=4780;
end;

procedure TForm1.CheckBox5Click(Sender: TObject);
begin
CheckBox5.tag:=w;
w:=3850;
end;

procedure TForm1.CheckBox6Click(Sender: TObject);
begin
CheckBox6.tag:=e;
e:=4500;
end;

procedure TForm1.CheckBox7Click(Sender: TObject);
begin
CheckBox7.tag:=r;
r:=3400;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
if RadioButton1.checked and checkbox4.Checked and checkbox5.Checked then
z:=(t+q+w)*i else
if RadioButton1.checked and checkbox5.Checked and checkbox6.Checked then
z:=(t+w+e)*i else
if RadioButton1.checked and checkbox6.Checked and checkbox7.Checked then
z:=(t+e+r)*i else
if RadioButton1.checked and checkbox4.Checked and checkbox6.Checked then
z:=(t+q+e)*i else
if RadioButton1.checked and checkbox4.Checked and checkbox7.Checked then
z:=(t+q+r)*i else
if RadioButton1.checked and checkbox5.Checked and checkbox7.Checked then
z:=(t+w+r)*i else

if RadioButton2.checked and checkbox4.Checked and checkbox5.Checked then
z:=(y+q+w)*i else
if RadioButton2.checked and checkbox5.Checked and checkbox6.Checked then
z:=(y+w+e)*i else
if RadioButton2.checked and checkbox6.Checked and checkbox7.Checked then
z:=(y+e+r)*i else
if RadioButton2.checked and checkbox4.Checked and checkbox6.Checked then
z:=(y+q+e)*i else
if RadioButton2.checked and checkbox4.Checked and checkbox7.Checked then
z:=(y+q+r)*i else
if RadioButton2.checked and checkbox5.Checked and checkbox7.Checked then
z:=(y+w+r)*i else

if RadioButton3.checked and checkbox4.Checked and checkbox5.Checked then
z:=(u+q+w)*i else
if RadioButton3.checked and checkbox5.Checked and checkbox6.Checked then
z:=(u+w+e)*i else
if RadioButton3.checked and checkbox6.Checked and checkbox7.Checked then
z:=(u+e+r)*i else
if RadioButton3.checked and checkbox4.Checked and checkbox6.Checked then
z:=(u+q+e)*i else
if RadioButton3.checked and checkbox4.Checked and checkbox7.Checked then
z:=(u+q+r)*i else
if RadioButton3.checked and checkbox5.Checked and checkbox7.Checked then
z:=(u+w+r)*i else

if RadioButton1.checked and checkbox4.Checked then
z:=(t+q)*i else
if RadioButton1.checked and checkbox5.Checked then
z:=(t+w)*i else
if RadioButton1.checked and checkbox6.Checked then
z:=(t+e)*i else
if RadioButton1.checked and checkbox7.Checked then
z:=(t+q)*i else

if RadioButton2.checked and checkbox4.Checked then
z:=(y+q)*i else
if RadioButton2.checked and checkbox5.Checked then
z:=(y+w)*i else
if RadioButton2.checked and checkbox6.Checked then
z:=(y+e)*i else
if RadioButton2.checked and checkbox7.Checked then
z:=(y+q)*i else

if RadioButton3.checked and checkbox4.Checked then
z:=(u+q)*i else
if RadioButton3.checked and checkbox5.Checked then
z:=(u+w)*i else
if RadioButton3.checked and checkbox6.Checked then
z:=(u+e)*i else
if RadioButton3.checked and checkbox7.Checked then
z:=(u+q)*i else


begin
if ComboBox1.Items.Strings[0]:=inttostr(x1) then
x1:=30950 else
if ComboBox1.Items.Strings[1]:=inttostr(x2) then
x2:=32200 else
if ComboBox1.Items.Strings[2]:=inttostr(x3) then
x3:=34000 else
If ComboBox1.Items.Strings[3]:=inttostr(x4) then
x4:=35000 else
If ComboBox1.Items.Strings[4]:=inttostr(x5) then
x5:=36700 else
If ComboBox1.Items.Strings[5]:=inttostr(x6) then
x6:=37000 else
If ComboBox1.Items.Strings[6]:=inttostr(x7) then
x7:=38900;
su:=z+x1+x2+x3+x4+x5+x6+x7;
end;
begin

if RadioButton1.checked then
showmessage('Âûáåðèòå ðàçìåð øèíû!') else
if RadioButton2.checked then
showmessage('Âûáåðèòå ðàçìåð øèíû!') else
if RadioButton3.checked then
showmessage('Âûáåðèòå ðàçìåð øèíû!') else
if checkbox4.Checked then
showmessage('Âûáåðèòå òèï øèíû!') else
if checkbox5.Checked then
showmessage('Âûáåðèòå òèï øèíû!') else
if checkbox6.Checked then
showmessage('Âûáåðèòå òèï øèíû!') else
if checkbox7.Checked then
showmessage('Âûáåðèòå òèï øèíû!');
if ComboBox1.Text = '' then
ShowMessage('Âûáåðèòå ìàðêó øèíû!');
label1.caption:=inttostr(su);
end;
end;

procedure TForm1.RadioButton1Click(Sender: TObject);
begin
if RadioButton1.checked then begin
RadioButton1.tag:=t;
t:=21300;
end;
end;

procedure TForm1.RadioButton2Click(Sender: TObject);
begin
if RadioButton1.checked then begin
RadioButton1.tag:=t;
y:=22300;
end;
end;

procedure TForm1.RadioButton3Click(Sender: TObject);
begin
if RadioButton1.checked then begin
RadioButton1.tag:=t;
u:=24300;
end;
end;
Fantss вне форума Ответить с цитированием
Старый 03.06.2010, 18:07   #6
Fantss
 
Регистрация: 22.03.2010
Сообщений: 7
По умолчанию

Решение найдено спс
Fantss вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
из combobox в переменную _alis_ Компоненты Delphi 4 23.04.2010 12:08
Из edit в переменную n014me Общие вопросы Delphi 2 23.03.2010 21:30
Загрузить в переменную Shouldercannon Общие вопросы Delphi 4 14.12.2009 11:14
Не в файл, а в переменную jocry Работа с сетью в Delphi 2 03.03.2009 11:35
Не могу внести строку из combobox в combobox!? tacer Помощь студентам 1 30.11.2007 19:45