Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 29th, 2005, 05:26 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default Button Column for Mobile Device

Hi All,
Im trying to create a button column for a mobile device running windows ce 2.0 with visual studio 2005.
I have tried to modify many examples and all have failed.
I beleive this may be because the inherited DataGridTextBoxColumn or DataGridStyle Column must now be different.
I am new to this area of dev and find the windows datagrid very complicated compared tot he asp.net one.

Has anyone created a button column for a datagrid with Visual Studio 2005 who might be able to provide some assistance?

Just a hint in the right direction will do.


Many thanks Rod

======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
__________________
======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================
 
Old November 29th, 2005, 09:44 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

This would be no problem in VS 2005 with classes like DataGridViewButtonColumn, but Rod if you are making use of grid controls with CF then I would say that I found them immensely disappointing. They have been literally rendered useless in Compact Framework. So I would say rather then trying to improve upon them it would be easier for you to go for something like dynamic addition of controls on the form through your code and manage the UI with panels.

I would add that I don’t know yet what kind of application you are making and what’s the final goal. If you could elaborate on that people over here may come up with something.

Regards
Ankur Verma
 
Old November 29th, 2005, 11:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Hi Ankur,
Thanks for your time.
I intend on having a list of jobs for am outside sales rep to make.
The datagrid lists the jobs, and there is a variety of statuss the job may be at'.
So I need to list them with attention grabbing colour for new jobs.
And various options for each job such as view details, accept, decline.
I was going to use a context menu.
I have to admit I find this all quite surprising.
I have been using C# and ASP.NET for about 3 years, this task would take me 15 minutes with an ASP.NET Datagrid.Fully customised with pretty little imagebuttons.
</WHINE>
So laying out controls in code, I'll look into that, any tutorial links would be much appreciated.
I think that will allow me the flexability I need in the display.

Many Thanks again Ankur,
Rod


======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
 
Old November 29th, 2005, 05:14 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

Rod, I had done a little research for an article on .NET 2005's capabilities in development for smart devices and stuff. When I had started it, CF was in very bad shape. Microsoft has been doing a lot of promises and I really appreciate that the interfaces that Pocket PCs or CE or other smart devices support are much richer then those of palm and stuff but CF was very unstable and had a few classes that didn’t make any sense in their depleted form. Microsoft has come a long way and their are a lot of improvements in CF regarding stability but some of the components are still left unfinished so to speak.
It was around that time that I had written a few small apps, I've modified my code to sort of create a sample code on which you may be able to base yours

Code:
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        Control AddButtons(String ID,Control after)
        {
            Button button2 = new System.Windows.Forms.Button();
            button2.Location = new System.Drawing.Point(40, after.Location.Y + 30);
            button2.Name = "Button" + ID.ToString();
            button2.Size = new System.Drawing.Size(24, 39);
            button2.TabIndex = 2;
            button2.Text = "button2";
            button2.Click += new System.EventHandler(PanelButton_Click);
            panel1.Controls.Add(button2);
            return (Control)button2;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Control temp = (Control)sender;
            for (int i = 1; i < 10; i++)
            {
                temp = AddButtons(i.ToString(), temp);
            }
        }

        private void PanelButton_Click(object sender, EventArgs e)
        {
            if(((Button)sender).Name == "Button1")
            {
                //STUFF
            }
            //MessageBox.Show(((Button)sender).Name);
        }
Ya, I don’t like being fed like this by code, myself, but i had this code so I'm giving it to you. The call to AddButtons can be moved to Form1_Load or some other suitable location, right now its at a button click.
Simpler way of generating such a code - just add the control you want to the form and format it the way you want. Go to InitializeComponent and copy the generated code from there, modify it to set the location and stuff properly and there you go. Good luck with your efforts.

Ankur
 
Old November 29th, 2005, 09:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Hi Ankur,
Thanks for that, it is a good starting place.
I will work on that.
Rod



======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set tabindex in gridview(Button column) amolchikurte ASP.NET 2.0 Professional 2 May 29th, 2007 11:54 PM
To get text of Button Field column in GridView nitinp ASP.NET 2.0 Basics 1 November 3rd, 2006 10:57 AM
Button in Datagrid Template Column thetway ASP.NET 1.0 and 1.1 Basics 1 October 11th, 2005 01:54 PM
Template Column in DataGrid and Button divsalar ASP.NET 1.x and 2.0 Application Design 1 January 23rd, 2005 12:43 AM
Datagrid Button/Hyperlink Column snowydust VB How-To 0 September 6th, 2004 02:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.