Foros del Web » Programación para mayores de 30 ;) » .NET »

Control hora minutos en .Net

Estas en el tema de Control hora minutos en .Net en el foro de .NET en Foros del Web. Hola quisiera saber si existe en .net algun control que ya tenga cargado los valores de las horas y minutos y permita seleccionarlos desde ya ...
  #1 (permalink)  
Antiguo 18/03/2005, 13:56
 
Fecha de Ingreso: septiembre-2004
Mensajes: 407
Antigüedad: 19 años, 8 meses
Puntos: 1
Control hora minutos en .Net

Hola quisiera saber si existe en .net algun control que ya tenga cargado los valores de las horas y minutos y permita seleccionarlos
desde ya muchas gracias
  #2 (permalink)  
Antiguo 19/03/2005, 00:37
 
Fecha de Ingreso: octubre-2004
Mensajes: 258
Antigüedad: 19 años, 7 meses
Puntos: 1
Hola , es el mismo control que el de fechas, DatePicker, solo cambias una propiedad que le dices que va a mostrat TIME y es todo.
__________________
Salute !!!
RollBack
  #3 (permalink)  
Antiguo 19/03/2005, 06:45
Avatar de Mickel  
Fecha de Ingreso: mayo-2002
Ubicación: Lima, Peru
Mensajes: 4.619
Antigüedad: 22 años
Puntos: 7
A ver si te sirve...

Esto seria el ascx
Código PHP:
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="uc_Hora.ascx.vb" Inherits="uc_Hora" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
<
asp:DropDownList id="ddl_Hora" runat="server" CssClass="cssInput" AutoPostBack="True"></asp:DropDownList>
<
asp:TextBox id="txt_Interval" runat="server" Width="8px" Height="8px" Visible="False">5</asp:TextBox>
<
asp:TextBox id="txt_ILimitM" runat="server" Visible="False" Height="8px" Width="8px">0</asp:TextBox>
<
asp:TextBox id="txt_ILimitH" runat="server" Visible="False" Height="8px" Width="8px">0</asp:TextBox>
<
asp:TextBox id="txt_SLimitM" runat="server" Visible="False" Height="8px" Width="8px">59</asp:TextBox>
<
asp:TextBox id="txt_SLimitH" runat="server" Visible="False" Height="8px" Width="8px">23</asp:TextBox>
<
asp:TextBox id="txt_Valor" runat="server" Visible="False" Height="8px" Width="8px"></asp:TextBox
y esto seria el codebehind. Perdon por la chambonada, pero esto lo hice cuando recien empezada con VB.NET y, bueno, como hasta ahora funciona...
Código PHP:
Public Class uc_Hora
    Inherits System
.Web.UI.UserControl

#Region " Web Form Designer Generated Code "
    
'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    End Sub
    Protected WithEvents ddl_Hora As System.Web.UI.WebControls.DropDownList
    Protected WithEvents txt_Interval As System.Web.UI.WebControls.TextBox
    Protected WithEvents txt_ILimitM As System.Web.UI.WebControls.TextBox
    Protected WithEvents txt_ILimitH As System.Web.UI.WebControls.TextBox
    Protected WithEvents txt_SLimitM As System.Web.UI.WebControls.TextBox
    Protected WithEvents txt_SLimitH As System.Web.UI.WebControls.TextBox
    Protected WithEvents txt_Valor As System.Web.UI.WebControls.TextBox

    '
NOTEThe following placeholder declaration is required by the Web Form Designer.
    
'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        '
CODEGENThis method call is required by the Web Form Designer
        
'Do not modify it using the code editor.
        InitializeComponent()
    End Sub
#End Region

#Region "Propiedades"
    Public Property Intervalo() As Int32
        Get
            If Not IsNumeric(txt_Interval.Text) Then txt_Interval.Text = "1"
            Return CType(txt_Interval.Text, Int32)
        End Get
        Set(ByVal Value As Int32)
            If Value > 60 Then Value = 60
            Me.txt_Interval.Text = Value.ToString
            PopulateHora()
        End Set
    End Property

    Public Property LimiteInferior() As String
        Get
            Return Me.txt_ILimitH.Text & ":" & Me.txt_ILimitM.Text
        End Get
        Set(ByVal Value As String)
            Me.txt_ILimitH.Text = Left(Value, 2).Valor.ToString
            If CType(Me.txt_ILimitH.Text, Int32) < 0 Then Me.txt_ILimitH.Text = "0"
            If CType(Me.txt_ILimitH.Text, Int32) >= 24 Then Me.txt_ILimitH.Text = "23"
            Me.txt_ILimitM.Text = Right(Value, 2).Valor.ToString
            If CType(Me.txt_ILimitM.Text, Int32) < 0 Then Me.txt_ILimitM.Text = "0"
            If CType(Me.txt_ILimitM.Text, Int32) >= 60 Then Me.txt_ILimitH.Text = "59"
        End Set
    End Property

    Public Property LimiteSuperior() As String
        Get
            Return Me.txt_SLimitH.Text & ":" & Me.txt_SLimitM.Text
        End Get
        Set(ByVal Value As String)
            Me.txt_SLimitH.Text = Left(Value, 2).Valor.ToString
            If CType(Me.txt_SLimitH.Text, Int32) < 0 Then Me.txt_SLimitH.Text = "0"
            If CType(Me.txt_SLimitH.Text, Int32) >= 24 Then Me.txt_SLimitH.Text = "23"
            Me.txt_SLimitM.Text = Right(Value, 2).Valor.ToString
            If CType(Me.txt_SLimitM.Text, Int32) < 0 Then Me.txt_SLimitM.Text = "0"
            If CType(Me.txt_SLimitM.Text, Int32) >= 60 Then Me.txt_SLimitH.Text = "59"
        End Set
    End Property

    Public Property Valor() As String
        Get
            txt_Valor.Text = ddl_Hora.SelectedItem.Value
            Return txt_Valor.Text
        End Get
        Set(ByVal Value As String)
            txt_Valor.Text = Value
            '
SeleccionaValorDropDownList es una funcion que permite setear un valor a un DropDownList
            SeleccionaValorDropDownList
(ddl_Horatxt_Valor.Text)
        
End Set
    End Property

    
Public Property Habilitado() As Boolean
        Get
            
Return ddl_Hora.Enabled
        End Get
        Set
(ByVal Value As Boolean)
            
ddl_Hora.Enabled Value
        End Set
    End Property
#End Region

    
Public Event Hora_Changed()

    Private 
Sub Page_Load(ByVal sender As System.ObjectByVal e As System.EventArgsHandles MyBase.Load
        Put user code to initialize the page here
        
If Not Page.IsPostBack Then
            PopulateHora
()
            If 
Len(txt_Valor.Text) > 0 Then SeleccionaValorDropDownList(ddl_Horatxt_Valor.Text)
        
End If
    
End Sub

    
Private Sub PopulateHora()
        
ddl_Hora.Items.Clear()
        
Dim num_I As Int32num_J As Int32num_Interval As Int32num_Max As Int32
        num_Interval 
CType(txt_Interval.TextInt32)
        For 
num_I CType(txt_ILimitH.TextInt32To CType(txt_SLimitH.TextInt32)
            If 
num_I CType(txt_ILimitH.TextInt32Then
                num_J 
CType(txt_ILimitM.TextInt32)
            Else
                
num_J 0
            End 
If
            If 
num_I CType(txt_SLimitH.TextInt32Then
                num_Max 
CType(txt_SLimitM.TextInt32)
            Else
                
num_Max 59
            End 
If
            Do While 
num_J <= num_Max
                ddl_Hora
.Items.Add(num_I.ToString.PadLeft(2"0") & ":" num_J.ToString.PadLeft(2"0"))
                
num_J num_J num_Interval
            Loop
        Next
    End Sub

    
Private Sub ddl_Hora_SelectedIndexChanged(ByVal sender As ObjectByVal e As System.EventArgsHandles ddl_Hora.SelectedIndexChanged
        RaiseEvent Hora_Changed
()
    
End Sub
End 
Class 
ojala te sirva y si lo mejoras... pasalo, pues...
__________________
No tengo firma ahora... :(
  #4 (permalink)  
Antiguo 19/03/2005, 08:39
Avatar de HenrydeSousa  
Fecha de Ingreso: septiembre-2004
Ubicación: Venezuela
Mensajes: 300
Antigüedad: 19 años, 8 meses
Puntos: 2
Guys están hablando de WebForms o WindowsForms?
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:16.