help.net

<font size="2"><br />Musing on .Net</font>

  • Webcam from a Pocket PC

    WebcamPda is really good.

    No fancy design, because it suppose to work from a Pocket PC, Palm or mobile phone with Internet access.

    It just list a huge collection of webcams around the world

  • My first story

    Well today, I will write my first story in this blog, and a first for me, writing an article on .Net !
    It's about strategy on how you can store in a database long forms with a lot of textboxes, checkboxes, and radiobuttons controls.

    This is coming from a real experience, where the basic model I built was not working at all, being very very slow, difficult to maintain.

    So I think this should be interesting for many of us (maybe not for the gurus ;-)).

    I will let you know when it's ready.

  • Control check the revenge ;-))

    UPDATED: read the end of the blog ;-)
    I start on a bad day today, with a nasty bug I can't figure out what's wrong.
     
    I loop through a series of controls using Typeof to populate a form with different values from the database.
    The control (D2) is embedded in another control D. This code is from my mainpage where I populate the forms.
    PageD2ctl is declared as a Panel, child of D2.

    The problem is that when the control is a Radiobutton, and I am sure it is(just checked in debug mode), my code enter correctly in the test, but it's going also in the Checkbox test, like suddenly my Radiobutton is now typed as a Checkbox.

    I spent sometime on that, but absolutly no clue about what's going on. I tried everything, transforming my nice ElseIf in If then loop, nothing at all.
     
    If anyone has an idea ?
     
     Dim MyCtl2 As Control
                        For Each MyCtl2 In PageD2ctl.controls
     
                            If Not (TypeOf MyCtl2 Is LiteralControl) Then
                                If MyCtl2.ID = dtr("id_q") Then
                                    If TypeOf MyCtl2 Is TextBox Then
                                        Dim ThisTextbox As TextBox = CType(PageD2ctl.findcontrol(dtr("id_q")), TextBox)
                                        ThisTextbox.Text = dtr("answer")
                                    Elseif TypeOf MyCtl2 Is RadioButton Then
                                        Dim ThisRadiobox As RadioButton = CType(PageD2ctl.findcontrol(dtr("id_q")), RadioButton)
                                        If LCase(dtr("answer")) = "true" Then
                                            ThisRadiobox.Checked = True
                                        End If
                                   
    '-- and there after succesfully finish the previous test if it's a radiobutton the code enter in the Checkbox one !

                                    ElseIf TypeOf MyCtl2 Is CheckBox Then
     
                                        Dim ThisCheckbox As CheckBox = CType(PageD2ctl.findcontrol(dtr("id_q")), CheckBox)
                                        If LCase(dtr("answer")) = "true" Then
                                            ThisCheckbox.Checked = True
                                        End If
                                    End if

                             End If
                           End if
                        Next
    UPDATE:
    I found this solution that I share now:

    This confirms (for me) that something going wrong there with the Controls. RadioButton inherits from Checkbox.
    Why this choice ?

    Instead of using an Elseif structure, I write a Select..Case structure like this (Myctl is the control to test):

    select case lcase(Myctl.gettype.tostring)
    case "system.web.ui.webcontrols.textbox"
    .. Mycode
    case "system.web.ui.webcontrols.radiobutton"
    .. MyCode
    case "system.web.ui.webcontrols.checkbox"
    .. Mycode
    end select

  • .Net future enhancements

    In answer to Slavomir blog, I accept that things are fixed for the version 2.

    But I regret that only MVPs were listened.
    Not that I have any doubt about their greatest Value, but I am worrying about the direction .Net going to take.

    Are we going to have more difficult and obscure classes and other strong features, or are we going to have a more 'friendly' model.

    I'm not a rookie, but I find some daily tasks difficult to achieve in .Net.Like as I said in my previous post, I enjoy every minute the painful process of looking at the controls arborescence to find the right item or value, for some basic tasks like finding a web control value.

    It's not obviously(well to my humble knowledge) a standard approach in every classes.

    Does anybody know an equivalent link of the
    C# changes for VB ?

    So can we talk about .Net 3.0 ;-))

  • .Net 2.0 request list

    Is it too early or can we start to build a list of important requirements for .Net 2 ?

    Not only bugs to be fixed (be positive ;-)) but improvements in VS.Net, language, etc...

    One of my first request will be to simplify, not sure how ;-), the hierarchical acces from the page throught the controls.
    It's quite hard to find a particular value in debugging, so much childs and keys !

    Another one will be Edit and continue in debug mode but Scott confirmed that it will be there.

    More GDI+ also , with (I just dream) access to the same facilities I have in a Windows application replicated for my Web application.

    An idea could be a kind of '.Net applet' like you have a Java applet embedded in IE. doing this, we should be able to develop some funky applications, why not windows games in a web page ;-)