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
J

JessStuart

@JessStuart
About
Posts
4
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Best Security For Small Database
    J JessStuart

    Howdy! I'm creating an application to keep track of people at an event. The app will run on a Windows 7 laptop, and have no network connectivity (I believe that means it's single tier?). The app is going to be written in C# 2008 Express, with the database in SQL Server 2008 Express. Here's the security concerns for the app: About 8 people (door volunteers) will use the app in a night, to register dancers when they arrive. Every half hour, the volunteer changes. The volunteers are highly computer challenged (or must be assumed to be so). I don't want a windows login for each volunteer. The app will prompt for the volunteer to "log in" to the app, as their shift starts. I'm considering a single windows user for the whole app. The volunteer app "login" will just be a record of whose at the door at a giving time. Here's my question: Is the best way to set up the database security to create the app user in windows, or to use SQL Authentication from within the program? What considerations indicate the best choice? Thanks, Jess

    Database database sysadmin security question csharp

  • Trigger a Parent Form Event From UserControl In TableLayoutPanel
    J JessStuart

    Thanks for the encouragement. Here's how I solved it, based on your example: Relavant Main Form Code:

        private void btnAddQuery\_Click(object sender, EventArgs e)
        {
            SQLXmlInterface newSxi = new SQLXmlInterface();
            newSxi.SaveButtonClicked += new System.EventHandler(SQLXmlInteface\_SaveButtonHandler);
            sqlInterfaces.Add(newSxi);
    
            tlpQueries.Controls.Clear();
            foreach (SQLXmlInterface sxi in sqlInterfaces)
            {
                sxi.Refresh();
                tlpQueries.Controls.Add(sxi);
            }
    
            RefreshControls();
        }
    
        private void SQLXmlInteface\_SaveButtonHandler(object sender, EventArgs e)
        {
            RefreshControls();
        }
    

    Here's the relevant Dynamically Added Child Control Code:

    public partial class SQLXmlInterface : UserControl
    {
        SQLXmlObject sqlObject;
        bool saved = false;
        bool validated = true;
        public event EventHandler SaveButtonClicked;
    
        private void btnSave\_Click(object sender, EventArgs e)
        {
            saved = true;
            sqlObject = new SQLXmlObject(txtTitle.Text, txtQuery.Text);
            RefreshControls();
            if (SaveButtonClicked != null)
                SaveButtonClicked(this, EventArgs.Empty);
        }
    }
    

    Synopsis (please correct if I've got it wrong): The Main Form "listens" to the child control by the EventHandler assigned to the newSxi.SaveButtonClicked event. The child object btnSave_Click event triggers (just calls, really) the SaveButtonClicked event. Since the Main Form has the EventHandler defined for the SaveButtonClicked event, when the SaveButtonClicked event occurs, the EventHandler for the Main Form runs the SQLXmlInteface_SaveButtonHandler method, which was assigned to it in this code from the Main Form:

    newSxi.SaveButtonClicked += new System.EventHandler(SQLXmlInteface_SaveButtonHandler);

    C# question database

  • Trigger a Parent Form Event From UserControl In TableLayoutPanel
    J JessStuart

    This helps a lot, but I think I forgot to explain something. The controls in the TableLayoutPanel are added at run time. How do I link the MainForm to each of the button click events for UserControls I'm adding at run time? Also, I'm adding the UserControls to TableLayoutPanel.Controls, not the MainForm directly. Do I need to do something different in that case? Just to make sure I've described it well: 0. The MainForm has a TableLayoutPanel with UserControls added to the TableLayoutPanel.Controls collection at run time. 1. I have a 'Save' button on any of the UserControls in the TableLayoutPanel. 2. I want the MainForm to run a method when 1. occurs. Note: I don't mean to doubt your example. I'm just at a learning stage where I want to make sure I understand exactly what's going on.

    C# question database

  • Trigger a Parent Form Event From UserControl In TableLayoutPanel
    J JessStuart

    Howdy, Thanks for looking into this. I have a single form application. The Main Form has a TableLayoutPanel. When a user clicks a button on the main form, a UserControl is added to the controls in the TableLayoutPanel. The UserControl has a button on it. What I'd like to happen: When the button on the UserControl is clicked, I want the Main Form to perform a method. How do I get the Main Form to listen to an event on a Button on the UserControl? Note: I need to see some code in the answer. I've read about delegates and such, but I'm not getting something. If I see it in code, I think I would understand. Thanks in advance :) Jess

    C# question database
  • Login

  • Don't have an account? Register

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