Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
procedure TForm1.DateTimePicker2Change(Sender: TObject);
var
day:tdatetime;
begin
Datetimepicker2.date:=day;
label1.caption:=(FormatDateTime('dd.mm.yyyy', day));
Hi!
I wanted to display selected date from datepicker on label but the label just show me the '30.12.1899' date of day and not the date which i selected from the datepicker.
Anyone have an idea? Thanks for the answers!
Your assignment should be reversed
day := Datetimepicker2.date;
You can also write that code without using local variable
procedure TForm1.DateTimePicker2Change(Sender: TObject);
begin
label1.caption:=(FormatDateTime('dd.mm.yyyy', Datetimepicker2.date));
end;
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 months ago.
Improve this question
Here is an example sheet:
https://docs.google.com/spreadsheets/d/1P91qqhClA8oO3-N9OGSxrFH-6lXxttZ3IN4bIGRGjHw/edit?usp=sharing
I am trying to get the column range returned in when the string in INPUT!B1 can be seen in DATABASE!A2:A into INPUT!C1:C3
You can use FILTER() function.
=FILTER(DATABASE!A:C,DATABASE!A:A=B1)
VLookup(), Index/Match(), QUERY() all these functions will work for you.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
Uses DateUtils;
.....
var d:TDateTime;
begin
d:=Time();
ShowMessage(DateTostr(d));
end;
it shows "" rather than the current time string
Your comment welcome
You get odd results because Time returns a the date 1899-12-30 with the current time, and DateToStr returns the date as a string.
I question your claim that it shows an empty string though as it shows the following on my end:
So you either need to return the full date and time like this:
d := Now;
but note that if you show the date, you're still not showing the time, so instead you need to show the time portion of the TDateTime variable instead of the date portion:
ShowMessage(TimeToStr(d));
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I want that every time a user clicks a button the number inside of it increases by 1. Below is the code to do that which works fine. However i want it to be in brackets e.g (1) when they press the button changes to (2) etc. How do i do this?
Thanks
-(IBAction)passButton:(id)sender{
passCounter = passCounter + 1;
passLabel.text = [NSString stringWithFormat:#"%i",passCounter];
}
-(IBAction)passButton:(id)sender{
passCounter++;
passLabel.text = [NSString stringWithFormat:#"(%i)",passCounter];
}
passLabel.text = [NSString stringWithFormat:#"(%i)",passCounter];
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
When I run application with these two codes, shows same error:
Operator not applicable to this operand type
procedure TForm1.Button4Click(Sender: TObject);
begin
If (shape1.Brush.Color:=clblue and shape2.Brush.Color:=clblue) then
begin
showMessage('error');
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
If (shape1.Brush.Color:=clblue) and (shape2.Brush.Color:=clblue) then
begin
showMessage('error');
end;
There are two problems here.
First, the operator being used, :=, is an assignment, not an equality check. For that, you want =.
Second, multiple comparisons in the same expression require parenthesis around each individual comparison, due to precedence problems with the and and or operators. So what you want is:
if (shape1.Brush.Color = clblue) and (shape2.Brush.Color = clblue) then
begin
showMessage('error');
end;
You should reread your Delphi manual!
A comparison for equality is a simple =, while a := is used for an assignment.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
what is the shortest code to copy all checked items from a TChecklistBox into a TStringlist ?
( for a TListbox I can you the assign function to add and extract a TStringlist with data)
Using plain vanilla Delphi (i.e. without any third party libraries) you just write a for loop:
StringList.Clear;
for i := 0 to CheckListBox.Items.Count-1 do
if CheckListBox.Checked[i] then
StringList.Add(CheckListBox.Items[i]);