Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I am doing a c# project of making "Age Calculator" and I have the following problem:
When i select February from month's combo box then in date's combo box it shows 1-31 numbers. But i want to show 1-29.How can i solve this without database?
private void ListBox1_SelectedValueChanged(object sender, EventArgs e)
{
if (ListBox1.SelectedValue == "February")
{
for (int i=1; i<=29; i++)
Listbox2.Items.Add(i.ToString());
}
}
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
I want write a program that :
In textbox type a picturebox name and in other textbox type location number,then press button to move that picturebox that name is equal textbox1 to that location.
my question is how I can send a object(picturebox) to a Function?
If I understand you correctly you want to move a picture box by entering its name into a textbox? Then this is a possibility:
private void button_click(object sender, EventArgs e)
{
string pBoxName = textbox1.Text;
// I don't quite understand what you mean by 'location number'
int newPos = int.Parse(textbox2.Text);
// boxList is a List<PictureBox>
PictureBox pBox = boxList.Where(x => x.Name.Equals(pBoxName)).FirstOrDefault();
if(pBox != null)
{
MoveTheBox(pBox, newPos);
}
}
private void MoveTheBox(PictureBox box, int newPos)
{
// move the box
}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a pictureBox and I want to perform a some statement when the image is clicked, So how can i check when the pictureBox is selected inside an if statement ?
Add an event handler to the MouseClick event, and then add in the code you want to run within the handler method:
MyPictureBox.MouseClick += new MouseEventHandler(MyEventHandler);
private void MyEventHandler(object sender, MouseEventArgs e)
{
//your code here
}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a typed dataset with a column called price, which is of string datatype. And I'm showing this via ultrgrid/datagrid
How can I show the price in number format.
For example: price ==123456
in the grid it should be like 12,354,56
Try this
var a = price.ToString("##,###,##");
Reference
Custom Numeric Format Strings!
Look at some of the related links to the right of the screen. Some of them even ask the same question as you !
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How to write this in C#?
Intent intent = new Intent(Intent.ActionSendMultiple, Android.Provider.MediaStore.Images.Media.ExternalContentUri);
handler(intent);
....
void handler(Intent intent)
{
ArrayList<Uri> imageUris = intent.GetParcelableArrayListExtra(Intent.ExtraStream);
...
}
ArrayList is available is c# but it does not have a generic (<T>) form. ArrayList is a list of objects.
What you want is System.Collections.Generic.List<T>
EDIT : In response to comments, try this;
List<Uri> imageUris = new List<Uri>(intent.GetIntegerArrayListExtra(Intent.ExtraStream));
Easy, just use List<Uri>. It's also faster than ArrayList.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'am struggling with the following, I have a datatable with some columns what i want is to have the items in this column displayed in a combobox. But it must not display double items.
How can i do this?
Try this:
private void FillComboFromColumnIndex(int columnIndex){
yourDataTable.AsEnumerable()
.Select(r=>r[columnIndex])
.Where(x=>x != null)
.Distinct().ToList()
.ForEach(x=>yourComboBox.Items.Add(x));
}
//To add all the items in column at index 1, do this
FillComboFromColumnIndex(1);
Try this, I'm not sure is it right answer on your question because I'm not sure if I have understood you as well:
Hidden Id With ComboBox Items?