Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

Thomas Chester

@Thomas Chester
About
Posts
5
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • using Word.Document's SaveAs Function (VB6)
    T Thomas Chester

    According to the SaveAs help documentation the default behaviour is to overwrite without prompting. What you can do is test to see if the file your are going to save as already exists, and then do something to select another name. In the code example below, if the file "c:\test.doc" exists the while loop will try for "c:\test_1.doc". If that file exists, it will then try for "c:\test_2.doc" and so on. Dim I As Long Dim SaveAsFileName As String Dim NewSaveAsFileName As String SaveAsFileName = "c:\Test.doc" NewSaveAsFileName = SaveAsFileName While Dir(NewSaveAsFileName, vbNormal) <> "" I = I + 1 NewSaveAsFileName = Left(SaveAsFileName, Len(SaveAsFileName) - 4) & "_" & i & _ Right(SaveAsFileName, 4) Wend

    Visual Basic question

  • how do I disable buttons if first row selected in DataGridView?
    T Thomas Chester

    Try using the DataGridView CellEnter event rather than the SelectionChanged event to toggle your navigation buttons.

    Visual Basic question database help tutorial career

  • webservice
    T Thomas Chester

    If you declare the class with the Serializable value then ASP.NET will take care of translating it into an XML datatype when it is returned. The added benefit of returning the class, besides returning multiple values, is that the XML elements will have the same name as the fields which in this example are Field1, Field2, and Field3. [Serializable] public class Class1 { private string _field1; private string _field2; private string _field3; public Class1() { } public Class1(string Value1, string Value2, string Value3) { this._field1 = Value1; this._field2 = Value2; this._field3 = Value3; } public string Field1 { get { return this._field1; } set { this._field1 = value; } } public string Field2 { get { return this._field2; } set { this._field2 = value; } } public string Field3 { get { return this._field3; } set { this._field3 = value; } } }

    COM question

  • Select by date
    T Thomas Chester

    You have two options of rephrasing your WHERE clause. Each solution assumes that both @Date and E.Start are declard as DATETIME: (1) WHERE E.Start BETWEEN @Date AND DATEADD(d, 1, @Date) This will look for E.Start values between midnight on @Date and midnight on @Date + 1 day (2) WHERE DAY(E.Start) = DAY(@Date) AND MONTH(E.Start) = MONTH(@Date) AND YEAR(E.Start) = YEAR(@Date) This will explicitly compare the month, day, and year components of each field and only flag those where all three are the same.

    Database question

  • tab page disable question
    T Thomas Chester

    You are correct in that you cannot disable a tab page, but you can either prevent a user from going back to a previous tab page or you can allow a user to go back to a previous tab page but disable all the controls on that tab page. The sample code below will disable all controls on a previous tab.

    private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (tabControl1.SelectedIndex > highestTabIndex)
        {
            foreach (Control c in tabControl1.TabPages[highestTabIndex].Controls)
            {
                PropertyInfo pi = c.GetType().GetProperty("Enabled");
    
                if (pi != null)
                     pi.SetValue(c, false, null);
            }
    
            highestTabIndex = tabControl1.SelectedIndex;
        }
    }
    

    The code is the event handler for the SelectedIndexChanged event of a tab control named tabControl1. It also assumes the existence of a form level variable declared as:

    private int highestTabIndex = 0;
    

    There are some limitations of the code, for instance if you start on tabPage1 and then click tabPage3 by skipping tabPage2 the code will disable only the controls on tabPage1. You would need to check the new index versus the old index to see if they only differ by one otherwise you could select the next page. So in this example when tabPage3 was selected by skipping tabPage2 you could change the selected tab to tabPage2 and then disable tabPage1. Tom Chester

    C# help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups