|
Thank alot for your reply.. i am trying the same now what you have been suggested....
vikas da
|
|
|
|
|
Use Validating event to validate the contents and cancel the event if required. This event will be fired when user moves focus out of the textbox, even pressing the ok button would trigger this event.
So, use this event to check if the text of the textbox is ok or not.
Nirandas,
a developer from India.
http://www.nirandas.com
|
|
|
|
|
Hi All,
I have 10 textboxes, with different lables,
during creating the text boxes i just do copy paste and didnt remeber to follow the sequence ..
now i am facing the problem here after loading the form when i am filling the values in the form ...am nevigating from one textbox to other using tab ... but its not working good ...means its going to first textbox then third then fifth as was copied so how can i make all this in order...
Thanks alot..
vikas da
|
|
|
|
|
When you are in the design view of the form, select the Tab Order item of the menu View to fix the sequence.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks alot ... it is done since i am using VS2008 so it is called here as tab order...
vikas da
|
|
|
|
|
thanks alot i got tab order also... this is nice
vikas da
|
|
|
|
|
Hi, i have datagrid and i have make the first column to be a checkbox
foreach (Category cat in categoryTable.Values)
{
string[] dataResult = { cat.Name, cat.Description };
this.dataGridCat.Rows.Add(dataResult);
}
categoryTable is my hashtable, and inside the values i store a Category object.
my datagrid first columm is name "Del" which is a checkbox, 2nd column is Name and 3rd column is Description.
I put the above foreach loop into the form load, so when the form is loaded, it will shows all the category in the hashtable. When the user check the checkbox or checkboxes and press the OK button, it will loop throught the datagrid and delete those that are checked
So now i need help on
1) Adding a checkbox
2) Looping throught the datagrid and check
|
|
|
|
|
1)
goto the dataGridView in The Design and click add Column
there choose tthe CheckBox Type Column
2)
Init The Coulmn With False Value
foreach (DataGridViewRow DGVW in dataGridView1.Rows)
{
DataGridViewCheckBoxCell dataCell = DGVW.Cells[0] as DataGridViewCheckBoxCell;
dataCell.Value = false;
}
When Checked the value will turn True
and The n Check :
foreach (DataGridViewRow DGVW in dataGridView1.Rows)
{
DataGridViewCheckBoxCell dataCell = DGVW.Cells[0] as DataGridViewCheckBoxCell;
if ((bool)dataCell.Value)
{
dataGridView1.Rows.Remove(DGVW);
}
}
Have Fun
Never forget it
|
|
|
|
|
private void FrmAddOrder_Load(object sender, EventArgs e)
{
int currentRow = 0;
foreach (Product p in productTable.Values)
{
this.dataGridProduct.Rows.Add();
this.dataGridProduct.Rows[currentRow].Cells["colProductName"].Value = p.Name;
this.dataGridProduct.Rows[currentRow].Cells["colModelNumber"].Value = p.ModelNumber;
this.dataGridProduct.Rows[currentRow].Cells["colCategory"].Value = p.Category;
this.dataGridProduct.Rows[currentRow].Cells["colDesc"].Value = p.Description;
this.dataGridProduct.Rows[currentRow].Cells["colMSRP"].Value = p.MSRP;
this.dataGridProduct.Rows[currentRow].Cells["colRetailPrice"].Value = p.RetailPrice;
currentRow++;
}
}
private void btnOK_Click(object sender, EventArgs e)
{
foreach (DataGridViewRow dgw in dataGridProduct.Rows)
{
DataGridViewCheckBoxCell datacell = dgw.Cells[0] as DataGridViewCheckBoxCell;
try
{
if ((bool)datacell.Value == true)
{
}
}
catch (NullReferenceException)
{
}
}
}
I have 2 hashtable
1st one is called orderTable;
2nd one is called productTable;
my "datagridproduct" will show the data that is productTable
The Order class have the following attribute
namespace EBMS
{
public class Order
{
private string refNumber;
private string custName;
private string destAdd;
private string destCity;
private DateTime orderDate;
private double totalPrice;
private Hashtable itemList;
I want to create a new Order object and the itemList will store those items in the dategridproduct that is checked.
How do i add my product that is checked into itemList and then add the itemList into my orderTable
modified on Tuesday, July 8, 2008 1:16 PM
|
|
|
|
|
Hi,
I am developing an application which retrievs data from a database and displays it into Datagridview. The data is displayed properly onto the Datagridview. Datatable is also used.
The question is how can i export/save this Datagridview table into a picture so that i can insert it into a mail.
Its a windows application in C#.
Feel free for any clarification.
Thanks in advance.
Praveen Raghuvanshi
Software Engineer,
India.
|
|
|
|
|
Control has a "DrawToBitmap " method which takes a screen shot of the control.
|
|
|
|
|
Thanks Navaneet for the response.
Still i have a problem. The problem is that 'DrawtoBitmap' gives a snapshot of the size of datagridview only. It doesn't give all the records like we have some hidden records in the datagridview which gets visible only by scroll bars.
I need to have all the records in the datagridview to be converted into a image so that i can embed it into a mail.
My requirement is to display a data obtained from a database onto a windows application. I want to embed that data into email in tabular form.
I would appreciate if there is any other way of achieving this.
Thanks in advance
Praveen Raghuvanshi
|
|
|
|
|
Hi,
I need to determine the location of label text in pixels as Margin, Padding, and TextAlign properties change
|
|
|
|
|
no,
you need to ask your mother to teach you some manners!!!!
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Thanks for your answer, but sorry it doesn't help
I advice you to ask your mother to teach you some attitude manners
|
|
|
|
|
Thanx for the 1 vote...
some of us are professional developers with alot of work to do and we dont have time to read pointless posts like yours, we keep an eye on these forums to help people to solve problems they are having.
NOW WHO THE HELL DO YOU THINK YOU ARE comming in here, and DEMANDING that we do YOUR WORK for you? are you stupid or something? no one here or anywhere else will do your work for you.
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Hi Harvey
My post is not pointless, I think you didn't understand it as you may be "stupid or something"
My problem is that, I'm working in an application in which I manually simulate some control appearance and draw them in a high resolution image to be printed, now when drawing a Label I need to determine the point(X, Y) on which I print the Label text, as Label.TextAlign may vary from MiddleCenter, to BottomLeft, to TopRight, etc.
Now, can you - as a "Professional" developer - help me??
I don't think so..
Even if my question is pointless, it's not enough reason for you to insult me
Sorry, but you are not a respectable person
|
|
|
|
|
Ahmad Safwat wrote: the location of label text in pixels as Margin, Padding, and TextAlign properties change
You won't get the location of the text, you can take location of the label instead. Check label.Bounds which gives you a Rectangle instance.
|
|
|
|
|
Sorry, but I don't understand how could label.Bounds help me to determine the location of text on Lable??
|
|
|
|
|
The bounds (which is type Rectangle) has members for top, bottom, right, and left. (left, top) gives you the location of the label's upper-left corner.
|
|
|
|
|
I guess if you want to know where exactly the text is painted within the label, you'll have to get the control's graphics object, determine the text size with its MeasureString methhod, and calculate the position with a lot of if statements according to alignment and things. But that's kind of like reinventing the label.
|
|
|
|
|
Hi Frank
yes that is exactly what I need and I already calculated the position but it's not accurate, so I was asking if there is an existing method to do
|
|
|
|
|
Hey, can anybody help me?
|
|
|
|
|
as in VB 6.0 we have recordset.movelast what is it in asp.net using C# where database is sql server 2005?
|
|
|
|
|
There is no equivilent in ADO.NET, it works in an entirely different way. Your best bet is to Google ADO.NET and read up on datareaders and datasets.
Hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|