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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
R

Rudyvb08

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

Posts

Recent Best Controversial

  • Refreshig a form with dynamic buttons.
    R Rudyvb08

    Thanks Ian! I'll give it a shot. May have to bug you if I get stuck writing out the code. Thanks again! Rudy :-D

    Visual Basic database help

  • Refreshig a form with dynamic buttons.
    R Rudyvb08

    Hi Guys! Wow! I wasn't even thinking that was my problem. But I'll do anything to make it better. So Ian, ID=17 refers to how many rows I will have. In my database, I have an ENABLED column. So if there is a TRUE value, than the button will be built. Your right about the layout, that's exactly how I will have it. But I also need to have it so if button 23, 24, 25 is not loaded, there will be a empty space there. So each button is always locked to it's location, so if I want two groups, I can have 1 to 20 and then 40 to 60. And I have a big gap between 20 to 40. Thanks for your help! Rudy

    Visual Basic database help

  • Refreshig a form with dynamic buttons.
    R Rudyvb08

    Hello all! So I'm having a little problem refreshing dynamic buttons on a form. I'm slowly making progress, but I want to make sure I'm doing it the right way, or maybe there is a better way. So here is some code. So this gets the data from the database so we know what buttons to load, etc,

    Private Function GetButtonData() As List(Of ButtonInfo)
    Dim constr As New SqlConnection(PVDBConn)
    'Dim PVDBConn As New SqlConnection("")
    'cmdUpd = New SqlCommand("SelVisName", constr)
    cmdUpd.CommandType = CommandType.StoredProcedure

        Dim lst As New List(Of ButtonInfo)
    
        Dim da As New SqlDataAdapter("SELECT VisId, VisName, VisEnabled, VisFlag, visPort, VisCpuName FROM tblVis ORDER BY VisId", constr)
    
        Dim t As New DataTable
    
        Try
            constr.Open()
            'PVDBConn.Open()
    
            da.Fill(t)
    
            For Each r As DataRow In t.Rows
    
    
                lst.Add(New ButtonInfo(CInt(r("VisId")), CStr(r("VisName")), CBool(r("VisEnabled")), CBool(r("VisFlag")), CStr(r("VisPort")), CStr(r("VisCpuName"))))
    
            Next
    

    Here is the code that will load the buttons on the form. I have this procedure in the OnLoad event of the form. This is the first form and the main form of the program.

    Private Sub GetButtonOnScreen()
    GetButtonData()

        Buttons = GetButtonData()
    
        For Each bi As ButtonInfo In Buttons
    
            If bi.Enabled Then
                'Dim prtLabel As New Label,
    
    
                ' MsgBox(prtLabel.Text.ToString)
                Dim newbutton As New Button
    
    
    
                'this is were it determines the color is red or blue
                If bi.HasChanges Then
                    newbutton.Image = My.Resources.pvmetal2red
                Else
                    newbutton.Image = My.Resources.pvmetal3
    
    
                End If
                newbutton.Text = bi.VisText
    
                Dim MinFont As New Font("arial", 12, FontStyle.Bold)
                newbutton.Font = MinFont
    
    
                newbutton.TextAlign = ContentAlignment.MiddleCenter
    
                newbutton.Tag = bi
    
                newbutton.Width = 102
    
    
                newbutton.Height = 42
    
                newbutton.BackColor = Color.AliceBlue
    
                'Plus 80 for Top
    
                newbutton.Top = 80 '+ (0 + bi.VisId)
    
                newbutton.Left = -95 + (100 \* bi.VisId)
    
    
                If newbutton.Left >= 906 Then
    
    Visual Basic database help

  • Getting the right sysntax for this.
    R Rudyvb08

    Hello all! This seems pretty simple, but I'm still stuck. Probably making it more complicated than it is. I have a tblPot, with Monday, Tuesday, etc as Columns. I need to return the Pot of the week based on todays date. I'm getting the day of the week from SQL with the DATENAME function. But how can I pass that to match the column name. Basicly I need this simple statement. SELECT Potname FROM tblPot WHERE Monday = 'true' How can I get it so it grabs the current day automaticly. Thanks! Rudy :-D here is the code

    ALTER PROCEDURE [dbo].[SchedPod]
    -- Add the parameters for the stored procedure here

    @Day nvarchar(50) Output,
    @PotList nvarchar(50) OUTPUT

    AS
    BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    -- Insert statements for procedure here
    

    select @Day = DATENAME(dw , getDate())

    SELECT @Potlist =  PotName
    

    FROM tblPot
    WHERE (@Day = 'true')

    END

    Database database regex 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