|
If you have other controls in the panel and the with of all controls exceed the with of the panel the controls that can not be displayed on the same row as the others will be placed on another row, under the visible ones, you might want to check for that.
|
|
|
|
|
First add your control in the Toolbox and than drag/drop your control to flowlayout panel
|
|
|
|
|
Good Day
i want to know how can i make in C# , OpenFileDialog then open image from this OpenFileDialog then can publish in my form .
Thank You
zidan
|
|
|
|
|
OpenFileDialog is just a class you create, it returns DialogResult.OK if the user presses OK. You can load a bitmap from the stream that is part of the dialog, or use the filename returned to open the image directly. You draw images on your form typcially with a picturebox. Do you have a C# book ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
openFileDialog1.Filter = "Images|*.jpg;*.gif;*.png|All files|*.*"; will display image files. You can use a PictureBox to display an image. There are tons of examples on Google.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Hi all,
I have get a dataset with 5 column and populate it into datagridview. My question is, how can i hide the 1st column to prevent it to show in the datagridview. I am using dataset.Tables[0].Columns.("Index") to remove the "Index" column. It successful to populate what i want ,but the problem is when i save the dataset back to the database, it show me an error below:
InvalidOperationException was unhandled:
Missing the DataColumn 'PD_Program_Name' in the DataTable 'ProgramDetails' for the SourceColumn 'PD_Program_Name'.
I am guess that is because i already remove that column when populate datagridview.So ,is there any solution that can archieve it without remove a column in dataset?
thanks in advance
regards
coccon
|
|
|
|
|
Define the DataGrivViewColumns that you want to display instead of letting the system auto generate the columns for you.
And don't temper with the datasource.
|
|
|
|
|
One way to do this.. is to just hide that column in the grid. so that in the back end it will be there but not visible to the user
|
|
|
|
|
Hi Nouman Bhatti and darkelv,
Thanks for the help. Yeah, i just need to hide the 1st column for displaying in datagridview by using visible properties,thanks guy .
|
|
|
|
|
HI,
In C# Windows solution, I'm using one DataGridView. It contains LinkLabel controls in one column.
Using the following code, I put LinkLabel controls in Edit column of DataGridView.
DataGridViewLinkColumn objDataGridViewLinkColumn = new DataGridViewLinkColumn();
objDataGridViewLinkColumn.HeaderText = "Edit";
objDataGridViewLinkColumn.DataPropertyName = "Change";
objDataGridViewLinkColumn.LinkColor = Color.Blue;
grdConfigurator.Columns.Add(objDataGridViewLinkColumn);
Can you guide me to handle click event of LinkLabel control, which is in DataGridView. Thanks in advance.
|
|
|
|
|
you can add the CellContentClickEvent and check if the control from the clicked cell is a link label
|
|
|
|
|
Yoy can try like this
private void dtGridLinkContainer_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
string str = ((System.Windows.Forms.DataGridView)(sender)).Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
--------------
-------------------------
------------------------
}
Thanks,
Tamojit
|
|
|
|
|
Good Day
i want to know how can i make in C# , OpenFileDialog then open image from this OpenFileDialog then can publish in my form .
Thank You
zidan
|
|
|
|
|
Please use intelligent headers, and edit your post rather than double posting
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi zidan, try this. Add the code to your form class in a button event handler:
if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
{
try
{
pictureBox1.Image = Bitmap.FromFile(openFileDialog1.FileName);
}
catch (Exception ex)
{
MessageBox.Show("Unable to load specified image: " + ex.Message, "Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
Also, set the Filter property of openFileDialog1 to only accept image files, e.g. 'Picture files (*.png;*.jpg)|*.png;*.jpg'
Good luck! Rob
"An eye for an eye only ends up making the whole world blind"
|
|
|
|
|
Hi,
I want to check the value of DateTime like " if(dateTime != null) {//Bla bla}" but because DateTime is struct, I can't check it with null. How can I check it?
|
|
|
|
|
It can't be null, obviously. If you want a nullable type, use DateTime? if you have C# 2.0 or 3.5
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
mm yes. Thank you for your answer.
|
|
|
|
|
Hi,
if you need a special value for a DateTime (e.g. to indicate "unspecified"), you should
consider DateTime.MinValue
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Hi all,
In my application, i have few delegate and it is work well,but one of the delegate prompt me the error below when using delegate to pass data from frmA to frmB:
NullReferenceException was unhandled
Object reference not set to an instance of an object.
Below is the sample coding:
formA:
public openForm callbackOpenForm;
public DisplayProgramNameDate callbackProName;
public openExistingProgram callbackExistProgram;
public formA{}
private void btnOpen_open_Click(object sender, EventArgs e)
{
callbackProName(cboProgram_open.Text, Convert.ToString(DateTime.Now));
callbackOpenForm("ProgramSetting");
callbackExistProgram(); <----------------------error on this delegate
this.Hide();
}
formB:
public formB{
formA fA = new formA();
fA.callbackExistProgram += new openExistingProgram(this.callbackExistProgramFn);
}
private void callbackExistProgramFn()
{
sqlconn.DbConnection();
ds = sqlconn.SelectSQL("ProgramSetting", "PS_Program_Name", singleton.ProName);
}
class Delegate:
public delegate void CreatePictureBox(Boolean b);
public delegate void DisplayProgramNameDate(String sName, String sDate);
public delegate void openForm(String sName);
public delegate void openExistingProgram();
can anyone help me on this?
thanks in advance
cocoon
|
|
|
|
|
You need to set a breakpoint, check if the delegate itself is null. If not, step into it and work out what line in the delegate code is causing the error.
cocoonwls wrote: formA fA = new formA(); fA.callbackExistProgram += new openExistingProgram(this.callbackExistProgramFn);
Scratch that. You need to do some reading on OO. The forma inside your formb has no relation whatsoever to the instance that is running and trying to call the delegate. So, hook it up using hte instance that actually is running. And, never call a delegate without checking first if it is null.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi Christian Graus,
Thanks for your help. I will do a checking first before call a delegate.
|
|
|
|
|
Great - that will stop the crash, but unless you hook up the right instance, it's still not going to work
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
|
While I am performing calculations my debug answers are showing up like 0x00000096.
Can I set a propery to display the actual numbers.
Can someone help?
Thanks.
Dougins
|
|
|
|