Skip navigation

Developer .NET UPDATE, December 19, 2003

Developer .NET UPDATE—brought to you by SQL Server Magazine

http://sqlmag.com

This Issue Sponsored By

DevConnections -- 2004 Date Announced

http://www.devconnections.com

Windows & .NET Magazine Connections -- 2004 Date Announced

http://www.winconnections.com

December 19, 2003--In this issue:

1. Developer .NET Perspectives

  • Compact Framework Tips and Tricks

2. Announcements

  • Looking for a New SQL Server Resource?
  • Need SQL Server Tips and Tricks?

3. Resource

  • Featured Thread: Framework 1.1 on Windows NT 4.0

4. Event

  • Receive a Free Identity Management White Paper!

5. New and Improved

  • Replace TextArea with WYSIWYG HTML Editor

6. Contact Us

  • See this section for a list of ways to contact us.

Sponsor: DevConnections -- 2004 Date Announced

DevConnections = Microsoft ASP.NET Connections + Visual Studio Connections + SQL Server Magazine Connections.

Spring 2004 DevConnections will be held April 18 - 21 at the Hyatt Grand Cypress in Orlando, FL. Be sure to save these dates on your calendar. Early registrants will receive the best discounts plus access to all three conferences for one low price.

Attend DevConnections and succeed in your job:

  • Get tailor-made solutions for your most pressing challenges
  • Compare your current strategies to best-practice advice from the world's top .NET gurus
  • Networking gatherings with your peers will help you uncover additional tricks and tips
  • Focused, technical, and in-depth content ensures you won't waste your time
  • Learn real world advice from experts in the field as well as insights from Microsoft product architects who built .NET technologies
  • Conference session details and speaker information is already on the Web. Go online today or call 800-899-5325 or 203-268-3204.

    http://www.devconnections.com

    1. Developer .NET Perspectives

    by Marquis Howard, [email protected]

  • Compact Framework Tips and Tricks
  • Dealing with the Windows .NET Compact Framework can be fun and challenging at the same time. Certain UI limitations force you to be creative in your form designs. These limitations are mainly visible because of the device's form factor. Let's face it; you don't have much room to work with. However, after you work with the Compact Framework for about 6 months, you won't notice these so-called limitations. You'll adapt and understand your environment and realize that to achieve the desired effect, you must perform certain tasks a certain way.

    Whether you're designing a thin-client application for the Web or a thick-client application for the desktop, the ability to quickly display data has been a key capability since the birth of the Windows .NET Framework. The DataGrid is a common UI element that works well for WinForm, Web, and Compact Framework applications.

    Binding a data source to the DataGrid is one of the easiest tasks you can perform. No matter whether your data source is a DataSet, a DataTable, or an array, the result is the same: The DataGrid will automatically display each column and row in your data source.

    For example, suppose your data source is a DataTable with five columns. In a desktop application or Web page, displaying all five columns would be no problem. Nor is displaying all five columns in a Compact Framework application a problem. You just have to adjust the DataGrid to scroll horizontally so that users can see all five columns. However, what if the customer for whom you're developing the application doesn't want any horizontally scrolling on the form?

    Depending on the customer's requirements, you can deal with this challenge several ways. Let's say the display area of the grid is about 24 pixels too wide for the screen. One solution is to narrow one or two of the columns by changing their size. But again, what if narrowing the columns isn't an option because doing so would truncate the columns' headers and the customer wants all column headers fully displayed?

    Here's a tip: In a DataGrid, the first column is always empty. This column is mainly used to select an entire row when you click the first cell of that row. The trick is to position the content of the grid to hide the first column--it doesn't contain any data anyway. The result is that users won't have to scroll horizontally to see the five columns that contain data.

    Every Microsoft .NET control has a Location property. The Location property consists of two points: X and Y. Changing one or both points causes the control's location to change. To hide the first column and focus the display on the DataGrid's contents, you need to change the X point to -24.

    Let's step through the process of how to change the X point. Open Visual Studio .NET 2003 and select New, Project on the File menu. In the Project Type pane on the left side of the New Project dialog box, select Visual C# Projects, and from the Templates pane on the right side, click Smart Device Application. Enter a project name in the Name text box. Click OK to bring up the Smart Device Application Wizard.

    The Smart Device Application Wizard asks two questions: "What platform do you want to target?" and "What project type do you want to create?" Accept the default selections of Pocket PC and Windows Application, respectively. Click OK to create your new project.

    You're now in Visual Studio .NET's Design window. From the Toolbox, drag a DataGrid control onto the form. You need to resize the grid so that it fits perfectly inside the screen. In the Properties pane on the right side, select the Size property and change its Width value to 240. Then, select the Location property and change both the X and Y points to 0.

    In the Design window, notice that the first column, which contains an arrow that points to the first row, is taking up valuable space in the display area. This column is the one you want to hide. In the Properties pane, edit the Location property by changing the X point to -24, then edit the Size property by changing the Width value to 264. This adjustment is all you need to satisfy the customer's requirements about displaying all five columns without truncating the column headers and without any horizontal scrolling.

    Suppose the customer tests the grid and notices that when he clicks a cell, the entire row doesn't get highlighted like it usually does. He wants that functionality back in the application. Fortunately, to regain that functionality, you don't need to restore the column you hid. Instead, you can use an event handler to create the same effect.

    The DataGrid has an event called MouseUp. By adding a handler to this event, you can enter code that determines the row to which the cell belongs and, based on the row's index, highlight the entire row. The code is

    private void DataGridCustomers_MouseUp(object sender, MouseEventArgs e)
    \{
    this.dataGridCustomers.Select(this.dataGridCustomers.CurrentRowIndex);
    \}

    If you want to highlight the row based on the selection of a particular column, you need additional code to determine which column of the selected row was chosen. For more information about adding such code and about other DataGrid control topics, check out the links at the following Web page:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbcondatagridoverview.asp

    Sponsor: Windows & .NET Magazine Connections -- 2004 Date Announced

    The Spring 2004 Windows & .NET Magazine Connections event will be held April 4 - 7 in Las Vegas at the new Hyatt Lake Las Vegas. Save these dates on your calendar. Early registrants will receive the greatest possible discount.

    For more information, please visit us online or call 800-505-1201 or 203-268-3204.

    http://www.winconnections.com

    2. Announcements
    (brought to you by SQL Server Magazine)

  • Looking for a New SQL Server Resource?

  • SQL Server Magazine is an endless library of the newest information and tools needed for SQL Server. Subscribe today and receive 12 issues, along with full access to the entire article archive, including the 24 latest issues--subscribers only. And you'll also receive the latest System Table Map Poster. Click here:

    https://secure.pentontech.com/nt/sql/index.cfm?promocode=psep213cdn

  • Need SQL Server Tips and Tricks?

  • The SQL Server Magazine Master CD offers extensive access to all articles, code, tips, tricks, and expertise published in SQL Server Magazine and T-SQL Solutions since their premier issues. Search by keyword, subject, author, or issue and retrieve desired information in real time. Subscribe today and start saving time. Click here:

    https://secure.pentontech.com/nt/sql/index.cfm?promocode=scep283cdn

    3. Resource

  • Featured Thread: Framework 1.1 on Windows NT 4.0
  • Novice forum member John wants to know whether he can install the Windows .NET Framework 1.1 on Windows NT Server 4.0. If you can answer this question, go to the following URL:

    http://www.winnetmag.com/forums/rd.cfm?cid=55&tid=65948

    4. Event
    (brought to you by SQL Server Magazine)

  • Receive a Free Identity Management White Paper!
  • Are your existing identity-management and access-control solutions fragmented, duplicated, and inefficient? Attend this free Web seminar and discover how to automate and simplify identity creation, administration, and access control. Leverage your investment in Microsoft technologies and benefit from greater security, improved productivity, and better manageability. Register now!

    http://www.winnetmag.com/seminars/identity

    5. New and Improved
    by Shauna Rumbaugh, [email protected]

  • Replace TextArea with WYSIWYG HTML Editor
  • Dart Communications released PowerWEB TextBox for ASP.NET, a Web-based component that lets ASP.NET developers add HTML editing and word processing capabilities to Web applications. PowerWEB TextBox for ASP.NET replaces the standard TextArea in a Web application with a WYSIWYG environment. Developers can use the Property Builder to configure many features without any code or create custom dialog boxes, drop-down buttons, skins, and menus with only a few lines of code. Pricing for one server and unlimited developers is $249, and a free trial is available at the company's Web site.

    http://www.dart.com

    Sponsored Link

    NetSupport
    Free Trial - Fast and Easy Network Management. - NetSupport DNA

    http://ad.doubleclick.net/clk;6823752;8214395;q?http://www.netsupport-inc.com/dna/netsupport_dna_overview.htm

    6. Contact Us

  • About Developer .NET Perspectives -- [email protected]
  • About the newsletter -- [email protected]
  • About technical questions -- http://www.sqlmag.com/forums
  • About product news -- [email protected]
  • About your subscription -- [email protected]
  • About sponsoring an UPDATE -- contact Kate Silvertooth ([email protected])
  • This email newsletter is brought to you by SQL Server Magazine, the independent source of technical, how-to information for SQL Server developers and administrators. Subscribe today.

    http://sqlmag.com/rd.cfm?code=00ex214xss

    Copyright 2003, Penton Media, Inc.

    Hide comments

    Comments

    • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

    Plain text

    • No HTML tags allowed.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Lines and paragraphs break automatically.
    Publish