|
Thanks!!
|
|
|
|
|
I need to have a user select an item from a combo box and I need to use that text. I have tried combobox.selecteditem, .selectedvalue, .selectedtext and none of these seem to work. Please help. Thanks in advance.
Also, the text originally comes from a database.
|
|
|
|
|
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged<br />
Dim myText As String<br />
myText = ComboBox1.SelectedItem.ToString<br />
End Sub
Chatura from Pearl of the Indian Ocean.
|
|
|
|
|
Hi Friend,
Sorry I don't know ur name.
First of all I would like to know which database u r using and whether u r retrieving data from the database or inserting the data into the database.
If u r firing a SQL query then I think this will b helpful to u :
strsql = "SELECT * FROM Emp WHERE Emp_Name='" & Combo1 & "'"
This query displays all the records from the table named 'Emp' according to the list item selected from the combobox named 'combo1'. 'strsql' is a string holding the query.
Success is not a Destination,
... But a Journey !!
|
|
|
|
|
mcqRecordset.Open "select * From MultipleChoice, MultipleChoiceAnswer,Level Where MultipleChoice.multipleChoiceID=MultipleChoiceAnswer.multipleChoiceID AND MultipleChoice.levelID=Level.levelID", myConnection, adOpenStatic, adLockOptimistic
Error: error in from clause
plz help me
Thx again
Arshaad
|
|
|
|
|
Keep it in the same thread!
---
b { font-weight: normal; }
|
|
|
|
|
Try restructuring the query...
select * From MultipleChoice AS MC<br />
JOIN MultipleChoiceAnswer AS MCA ON MC.multipleChoiceID = MCA.multipleChoiceID<br />
JOIN Level AS L<br />
ON MC.levelID = L.levelID<br />
...Steve
1. quod erat demonstrandum
2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once
|
|
|
|
|
hello there, any help in the following:
For sure u tried to change the skin of windows media player,when u choose the skin the interface(form) take the shape of a certain picture,not the square shape of the ordinary form, example the radiohead skin.
Any help using VB.NET and ill be very very thanksfull
|
|
|
|
|
Set FormBorderStyle property to None
Set the BackgroundImage property to the image you want to use
Now set the TransparencyKey property to the background color of the image.
Run you app
Note: When I tried to do this by using VB.Net 2003 it didn?t work. Solution to this problem is reseting the screen to use color values that are 24 bits or less. In Vb.Net 2005, it works fine.
If the background color of the image appears in your image too, you can see holes in your image, therefore, do not use a common color as the background color of the image.
Chatura from Pearl of the Indian Ocean.
|
|
|
|
|
i've also noticed that not all video cards will make the backgronud color transparent, so be aware that someone running your app could still see the original shape of the form
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
thanks a lot Chatura for ur help
|
|
|
|
|
Hello, iam doing a software, and i need code to open a .doc file on its own (this file to open in MSword) using VB.NET.
-- modified at 4:55 Sunday 26th March, 2006
|
|
|
|
|
|
Hi Guys,
Well I'm totally stumped. I've got a bit of vbscript code that tries to find a particular process running on a machine (Windows NT). If the process exists I want the text ("I am running...") displayed. If it doesn't exist then I want the text ("I am not running") displayed.
Just some background on the OS. Its Win NT 4 service pack 6 and i reinstalled WMI Core 1.5
On win xp, win 2k and win 2k3 the script below works fine. However on windows nt where this will reside on it fails giving me an error 80041001 which I belive is a "Call failed" error.
Can anyone shed some light on why this would be happening on NT in particular? Thanks in advance
<%
Dim strComputer, strProcess
strComputer = "."
On Error Resume Next
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}! \\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process")
For Each objProcess in colProcess
do while objProcess.name = "Someprocess.exe"
strProcess = objProcess.name
'objProcess.Name
'If objProcess.name = "Someprocess.exe" then
Response.Write ("I am running...")
'Else
'End If
Exit Do
Loop
Next
If strProcess = "" then
Response.Write ("I am NOT running")
End If
%>
|
|
|
|
|
Does the account the this script is running under have at least PowerUser permissions to the machine you're monitoring?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How do I set the permissions for users in Windows NT? The interface is not what Im used to and Im not sure how I can change it. Thanks
|
|
|
|
|
What user account is this script running under??? Is this script in a web page?? Does the script run on the server or on the client side?? Are you running it by double-clicking a *.VBS file??
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The script is in a webpage and runs on the server. How do I determine which account is running that script. I would have though it would have been the IUSR_xxxxxxxx account or am I wrong?
|
|
|
|
|
It'll be that account and, No, it doesn't have sufficient rights to do what you want. Add that account to the Power Users group and it'll get the rights it needs. BUT!!! BEWARE!!! This ia a HUGE security risk if your NT server is visible to the Internet.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Where do you actually setup the permissions for accounts in Windows NT?
|
|
|
|
|
Here goes the question with the code, I can't find how to append a zip with code, but you should be able to copy-paste and compile the code on the bottom after question
the first part is how to call this warning window through a tread
AlertWindow is the class that displays the message
Dim aFrmAlertPopUp As New AlertWindow("oi", "test", "123", "A", "dude", "joe", "joe", "A", ListView1, "", "123", "123")
if you invoke like this, it just works fine:
aFrmAlertPopUp.display()
if you invoke through a thread, it does go through (i see it steping though with VS) but won't show
'Dim t As New Thread(New ThreadStart(AddressOf aFrmAlertPopUp.display))
't.IsBackground = True
't.Start()
End Sub
The freaky thing is that if you add a msgbox("hello") in one of the methos of aletwindow, it works fine, but i don't want the message box to pop. why is it happening, is there anything that a message box triggers that i am not addind on that method
Private Sub startDisplay(ByVal displayCall As String)
setWarningProperties(displayCall)
lblBody.Text = message
lblSysOrigin.Text = sysOrigin
setLocation()
Me.Opacity = 0
Try
Me.Show()
currentTimer = timerFadeIn
timerFadeIn.Start()
Catch err As Exception
MsgBox(err.Message)
Finally
MsgBox("23")
End Try
End Sub
here is the whole code for AlertWindow.vb:
Imports System.Reflection
Public Class AlertWindow
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents timerFadeIn As System.Timers.Timer
Friend WithEvents timerWait As System.Timers.Timer
Friend WithEvents timerFadeOut As System.Timers.Timer
Friend WithEvents btnProcess As System.Windows.Forms.Button
Friend WithEvents btnDecline As System.Windows.Forms.Button
Friend WithEvents lblSysOrigin As System.Windows.Forms.Label
Friend WithEvents imgTopBar As System.Windows.Forms.PictureBox
Friend WithEvents lblBody As System.Windows.Forms.Label
Friend WithEvents lblUser As System.Windows.Forms.Label
Friend WithEvents lblCaseNo As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.timerFadeIn = New System.Timers.Timer
Me.timerFadeOut = New System.Timers.Timer
Me.timerWait = New System.Timers.Timer
Me.btnProcess = New System.Windows.Forms.Button
Me.btnDecline = New System.Windows.Forms.Button
Me.lblSysOrigin = New System.Windows.Forms.Label
Me.imgTopBar = New System.Windows.Forms.PictureBox
Me.lblBody = New System.Windows.Forms.Label
Me.lblUser = New System.Windows.Forms.Label
Me.lblCaseNo = New System.Windows.Forms.Label
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Button1 = New System.Windows.Forms.Button
CType(Me.timerFadeIn, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.timerFadeOut, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.timerWait, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'timerFadeIn
'
Me.timerFadeIn.Interval = 50
Me.timerFadeIn.SynchronizingObject = Me
'
'timerFadeOut
'
Me.timerFadeOut.Interval = 50
Me.timerFadeOut.SynchronizingObject = Me
'
'timerWait
'
Me.timerWait.AutoReset = False
Me.timerWait.Interval = 4000
Me.timerWait.SynchronizingObject = Me
'
'btnProcess
'
Me.btnProcess.BackColor = System.Drawing.SystemColors.ActiveCaption
Me.btnProcess.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
Me.btnProcess.Location = New System.Drawing.Point(240, 216)
Me.btnProcess.Name = "btnProcess"
Me.btnProcess.TabIndex = 7
Me.btnProcess.Text = "Process"
'
'btnDecline
'
Me.btnDecline.BackColor = System.Drawing.SystemColors.ControlDarkDark
Me.btnDecline.ForeColor = System.Drawing.SystemColors.ActiveCaptionText
Me.btnDecline.Location = New System.Drawing.Point(8, 216)
Me.btnDecline.Name = "btnDecline"
Me.btnDecline.TabIndex = 8
Me.btnDecline.Text = "Decline"
'
'lblSysOrigin
'
Me.lblSysOrigin.BackColor = System.Drawing.Color.Transparent
Me.lblSysOrigin.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblSysOrigin.ForeColor = System.Drawing.SystemColors.HotTrack
Me.lblSysOrigin.Location = New System.Drawing.Point(8, 24)
Me.lblSysOrigin.Name = "lblSysOrigin"
Me.lblSysOrigin.Size = New System.Drawing.Size(312, 23)
Me.lblSysOrigin.TabIndex = 9
'
'imgTopBar
'
Me.imgTopBar.Location = New System.Drawing.Point(0, 0)
Me.imgTopBar.Name = "imgTopBar"
Me.imgTopBar.Size = New System.Drawing.Size(328, 12)
Me.imgTopBar.TabIndex = 11
Me.imgTopBar.TabStop = False
'
'lblBody
'
Me.lblBody.BackColor = System.Drawing.Color.Transparent
Me.lblBody.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.lblBody.Location = New System.Drawing.Point(8, 136)
Me.lblBody.Name = "lblBody"
Me.lblBody.Size = New System.Drawing.Size(312, 72)
Me.lblBody.TabIndex = 14
'
'lblUser
'
Me.lblUser.BackColor = System.Drawing.Color.Transparent
Me.lblUser.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.lblUser.Location = New System.Drawing.Point(48, 56)
Me.lblUser.Name = "lblUser"
Me.lblUser.Size = New System.Drawing.Size(264, 16)
Me.lblUser.TabIndex = 15
'
'lblCaseNo
'
Me.lblCaseNo.BackColor = System.Drawing.Color.Transparent
Me.lblCaseNo.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.lblCaseNo.Location = New System.Drawing.Point(72, 80)
Me.lblCaseNo.Name = "lblCaseNo"
Me.lblCaseNo.Size = New System.Drawing.Size(240, 16)
Me.lblCaseNo.TabIndex = 16
Me.lblCaseNo.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'Label1
'
Me.Label1.BackColor = System.Drawing.Color.Transparent
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(8, 56)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(32, 16)
Me.Label1.TabIndex = 17
Me.Label1.Text = "User:"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'Label2
'
Me.Label2.BackColor = System.Drawing.Color.Transparent
Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.Location = New System.Drawing.Point(8, 80)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(56, 16)
Me.Label2.TabIndex = 18
Me.Label2.Text = "Case NO:"
Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'Label3
'
Me.Label3.BackColor = System.Drawing.Color.Transparent
Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.Location = New System.Drawing.Point(8, 112)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(72, 16)
Me.Label3.TabIndex = 19
Me.Label3.Text = "Message:"
Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'Button1
'
Me.Button1.BackColor = System.Drawing.SystemColors.ControlDarkDark
Me.Button1.ForeColor = System.Drawing.SystemColors.HighlightText
Me.Button1.Location = New System.Drawing.Point(96, 216)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 20
Me.Button1.Text = "Snooze"
'
'AlertWindow
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(328, 250)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.lblCaseNo)
Me.Controls.Add(Me.lblUser)
Me.Controls.Add(Me.lblBody)
Me.Controls.Add(Me.imgTopBar)
Me.Controls.Add(Me.lblSysOrigin)
Me.Controls.Add(Me.btnDecline)
Me.Controls.Add(Me.btnProcess)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
Me.Name = "AlertWindow"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
Me.Text = "frmAlertPopUp"
Me.TopMost = True
CType(Me.timerFadeIn, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.timerFadeOut, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.timerWait, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Dim currentTimer As System.Timers.Timer
Private sender As String
Private alertMessageArray As String
'Private Sender As String
'''determines the background color
Private _windowInstance As String
'''determines the logo
Private _sysOrigin As String
'''carries the alert id
Private _alertId As String
'''carries the message
Private _message As String
'''carries the user alias
Private _userAlias As String
'carries the team member alias
Private _altTeamMember As String
Private _alertInstance As String
'''alert types - ("SAS" "SAP" "SAD" "SAR" "SAX" "GAS" "GAP" "GAC")
Private _altAlertType As String
Private _MessageTime As String
Private _AlertGUID As String
Private _alertCaseNO As String
''''timers for window management
Private AlertWindowTimer As New System.Windows.Forms.Timer
Private SecondWarning As New System.Windows.Forms.Timer
Private ExpiryWarning As New System.Windows.Forms.Timer
Private Snooze As New System.Windows.Forms.Timer
''''timers for window management
Private countWarnings As Integer = 0
'Private asm As Assembly = System.Reflection.Assembly.GetExecutingAssembly()
Private _ControlToCheck As ListView
'''
''' windowInstance() property
'''
Public Property windowInstance() As String
Get
Return _windowInstance
End Get
Set(ByVal Value As String)
_windowInstance = Value
End Set
End Property
'''
''' sysOrigin() property
'''
Public Property sysOrigin() As String
Get
Return _sysOrigin
End Get
Set(ByVal Value As String)
_sysOrigin = Value
End Set
End Property
'''
''' alertId() property
'''
Public Property alertId() As String
Get
Return _alertId
End Get
Set(ByVal Value As String)
_alertId = Value
End Set
End Property
'''
''' message() property
'''
Public Property message() As String
Get
Return _message
End Get
Set(ByVal Value As String)
_message = Value
End Set
End Property
'''
''' userAlias() property
'''
Public Property userAlias() As String
Get
Return _userAlias
End Get
Set(ByVal Value As String)
_userAlias = Value
End Set
End Property
'''
''' altTeamMember() property
'''
Public Property altTeamMember() As String
Get
Return _altTeamMember
End Get
Set(ByVal Value As String)
_altTeamMember = Value
End Set
End Property
'''
''' AlertType() property
'''
Public Property AlertType() As String
Get
Return _altAlertType
End Get
Set(ByVal Value As String)
_altAlertType = Value
End Set
End Property
'''
''' alertInstance() property
'''
Public Property alertInstance() As String
Get
Return _alertInstance
End Get
Set(ByVal Value As String)
_alertInstance = Value
End Set
End Property
'''
''' MessageTime() property
'''
Public Property MessageTime() As String
Get
Return _MessageTime
End Get
Set(ByVal Value As String)
_MessageTime = Value
End Set
End Property
'''
''' MessageTime() property
'''
Public Property alertGUID() As String
Get
Return _AlertGUID
End Get
Set(ByVal Value As String)
_AlertGUID = Value
End Set
End Property
'''
''' MessageTime() property
'''
Public Property alertCaseNO() As String
Get
Return _alertCaseNO
End Get
Set(ByVal Value As String)
_alertCaseNO = Value
End Set
End Property
'''
''' Constructor
'''
Public Sub New(ByVal message As String, _
ByVal sysOrigin As String, _
ByVal alertId As String, _
ByVal windowInstance As String, _
ByVal userAlias As String, _
ByVal altTeamMember As String, _
ByVal altAlertType As String, _
ByVal alertInstance As String, _
ByVal controlToCheck As ListView, _
ByVal messageTime As String, _
ByVal alertGUID As String, _
ByVal alertCaseNo As String)
MyBase.New()
InitializeComponent()
_windowInstance = windowInstance
_sysOrigin = sysOrigin
_message = message
_alertId = alertId
_userAlias = userAlias
_altTeamMember = altTeamMember
_altAlertType = altAlertType
_alertInstance = alertInstance
_ControlToCheck = controlToCheck
_AlertGUID = alertGUID
_alertCaseNO = alertCaseNo
If (messageTime <> "") Then
_MessageTime = messageTime
Else
_MessageTime = "3"
End If
End Sub
'''
''' Sets the position of the window on the monitor
'''
Private Sub setLocation()
Dim x As Integer = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Right
Dim y As Integer = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom
x -= Me.Width
y -= Me.Height
Me.Location = New Point(x, y)
End Sub
'''
''' Finds if the warning still exists on the listview
'''
Private Sub startDisplay(ByVal displayCall As String)
setWarningProperties(displayCall)
lblBody.Text = message
lblSysOrigin.Text = sysOrigin
setLocation()
Me.Opacity = 0
Try
Me.Show()
currentTimer = timerFadeIn
timerFadeIn.Start()
Catch err As Exception
MsgBox(err.Message)
Finally
MsgBox("23")
End Try
End Sub
'''
''' receive the time and calculates when timers start to tick
''' if no time or time is less then 3 minutes, default time is set to 3 minutes
'''
Private Function CalculateWarningTime(ByVal Time As String, ByVal warningInstance As String) As Integer
Dim timeInSeconds As Integer
Dim calculatedTime As Integer
'''time passed from message is converted to integer
timeInSeconds = Convert.ToInt32(Time)
'''If smaller then minimun default, set to 3 minutes
If (timeInSeconds < 3) Then
timeInSeconds = 30000
Else
timeInSeconds = Convert.ToInt32(Time & "0000")
End If
Select Case warningInstance
Case "F"
calculatedTime = timeInSeconds - 30000
Case "S"
calculatedTime = timeInSeconds - 20000
Case "T"
calculatedTime = timeInSeconds - 10000
End Select
Return calculatedTime
End Function
'''
''' prepares window to display
''' pass alert info to vars and labels
'''
Friend Sub display()
Try
sender = userAlias
alertMessageArray = "oi" '/AlertMessage
'''need to pass case NO
lblCaseNo.Text = alertCaseNO
Select Case AlertType
Case "GAS", "GAP", "GAC"
btnDecline.Visible = False
btnDecline.Enabled = False
Case Else
End Select
If (altTeamMember <> "") Then
Me.lblUser.Text = altTeamMember
Else
Me.lblUser.Text = "No User"
End If
Me.lblBody.Text = alertMessageArray 'anAlert.message
Me.lblSysOrigin.Text = sysOrigin
Me.BackColor = Color.Azure
''''could add another timer to check if record is still there
AddHandler AlertWindowTimer.Tick, AddressOf TimerEventProcessor
startWindowImmediatly()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
'''
''' if time is >= 3mins, show indow right the way
'''
Private Sub startWindowImmediatly()
Try
startDisplay("A")
AddHandler SecondWarning.Tick, AddressOf SecondWarningEventProcessor
SecondWarning.Interval = CalculateWarningTime(MessageTime, "S")
SecondWarning.Start()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
'''
''' FIRST ALERT WARNING
'''
'''
''' First timer even hadler
''' raises first warning
'''
Private Sub TimerEventProcessor(ByVal myObject As Object, ByVal myEventArgs As EventArgs)
AlertWindowTimer.Stop()
startWindowImmediatly()
End Sub
'''
''' second timer even hadler
'''
Private Sub SecondWarningEventProcessor(ByVal myObject As Object, ByVal myEventArgs As EventArgs)
SecondWarning.Stop()
startDisplay("B")
MsgBox("3")
AddHandler ExpiryWarning.Tick, AddressOf FinalWarningEventProcessor
ExpiryWarning.Interval = CalculateWarningTime(MessageTime, "T")
ExpiryWarning.Start()
End Sub
'''
''' third timer even hadler
'''
Private Sub FinalWarningEventProcessor(ByVal myObject As Object, _
ByVal myEventArgs As EventArgs)
If (AlertType = "TAS") Then
startDisplay("C")
countWarnings = 2
Else
ExpiryWarning.Stop()
startDisplay("C")
countWarnings = 3
End If
End Sub
'''
''' determines the background color of the window
'''
Private Sub setWarningProperties(ByVal warnInstance As String)
'Dim path As String = System.Server.MapPath("~/green.bmp")
Select Case warnInstance
Case "A"
Me.BackColor = Color.Azure
End Select
End Sub
'''
''' timer makes window show fading in
'''
Private Sub timerFadeIn_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles timerFadeIn.Elapsed
If Me.Opacity >= 0.9 Then
Try
timerFadeIn.Stop()
currentTimer = timerWait
timerWait.Start()
Catch err As Exception
Finally
End Try
Else
Me.Opacity += 0.05
End If
End Sub
'''
''' timer holds window showing info
'''
Private Sub timerWait_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles timerWait.Elapsed
Try
timerWait.Stop()
currentTimer = timerFadeOut
timerFadeOut.Start()
Catch err As Exception
Finally
End Try
End Sub
'''
''' timer stop window and send Expire message
'''
Private Sub timerFadeOut_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles timerFadeOut.Elapsed
If Me.Opacity <= 0.1 Then
timerFadeOut.Stop()
If countWarnings = 3 Then
Me.Close()
Else
Me.Hide()
End If
Else
Me.Opacity -= 0.05
End If
End Sub
'''
''' Kills this form
'''
Public Sub StopWindow()
Try
currentTimer.Stop()
AlertWindowTimer.Stop()
Me.Close()
Catch ex As Exception
End Try
End Sub
End Class
here is the code to invoke:
Imports System.Threading
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents ListView1 As System.Windows.Forms.ListView
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.ListView1 = New System.Windows.Forms.ListView
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(104, 152)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 0
Me.Button1.Text = "Button1"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(88, 48)
Me.Label1.Name = "Label1"
Me.Label1.TabIndex = 1
Me.Label1.Text = "Label1"
'
'ListView1
'
Me.ListView1.Location = New System.Drawing.Point(88, 40)
Me.ListView1.Name = "ListView1"
Me.ListView1.TabIndex = 2
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.ListView1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim aFrmAlertPopUp As New AlertWindow("oi", "test", "123", "A", "dude", "joe", "joe", "A", ListView1, "", "123", "123")
' aFrmAlertPopUp.display()
Dim t As New Thread(New ThreadStart(AddressOf aFrmAlertPopUp.display))
t.IsBackground = True
t.Start()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
|
|
|
|
|
OK. First, your post is EXCESSIVELY long. I, for one, am not looking through all of this to find out what you're doing right and not doing right.
But, as a rule, ALL UI elements, including forms, should only be shown on the UI thread. NOT from a background thread. This is because forms put up on a different thread are cut off from the applications message pump, which only exists on the startup thread.
After just briefly scanning throught his code, I fail to see why you need to start a background thread to put up this form anyway.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i want get callerId by vb.net 2003
please some body help me .....
123
|
|
|
|
|
hi friend
you are use msscommlib.ocx. add project mscomm and set ComPort value 3.
add to project ; 1 button control , 1 timer , 1 textbox control
button control text = Connect
timer1 interval = 100
timer1 enable = false
-----------------------------------------------------------------------
Dim mscomm1 As New MSCommLib.MSComm
Send AT command to modem
<br />
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click<br />
<br />
Try<br />
mscomm1.CommPort = 3<br />
mscomm1.PortOpen = True<br />
mscomm1.Output = "AT#CID=1" & Chr(13)<br />
<br />
TextBox1.Text = TextBox1.Text & mscomm1.Input<br />
<br />
<br />
mscomm1.Output = "AT%CCID=1" & Chr(13)<br />
TextBox1.Text = TextBox1.Text & mscomm1.Input<br />
<br />
mscomm1.Output = "AT+VCID=1" & Chr(13)<br />
TextBox1.Text = TextBox1.Text & mscomm1.Input<br />
<br />
mscomm1.Output = "AT#CC1" & Chr(13)<br />
TextBox1.Text = TextBox1.Text & mscomm1.Input<br />
<br />
mscomm1.Output = "AT*ID1" & Chr(13)<br />
TextBox1.Text = TextBox1.Text & mscomm1.Input<br />
<br />
Timer1.Enabled = True<br />
<br />
<br />
Catch ex As Exception<br />
MsgBox(ex.message)<br />
End Try<br />
<br />
<br />
End Sub<br />
anyone return OK value , your modem support CallerID , if all value return ERROR your modem not support CallerID.
now timer1.enable = true and my program listen a COM3 and return value write a textbox control.
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
TextBox1.Text = TextBox1.Text & mscomm1.Input<br />
End Sub
if telephone ringing , textbox control text changed and display callerID value
RING
DATE ........
TIME ........
NUMBER .......
RING
RING
--------------------------------------
get number value the text control
Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged<br />
modemcontrol()<br />
End Sub
<br />
Sub modemcontrol()<br />
Try<br />
Dim m As String<br />
Dim r As String = TextBox1.Text<br />
m = r.Substring(123, 1)<br />
<br />
If m = "0" Then<br />
r = r.Substring(123, 11)<br />
GoTo there<br />
End If<br />
<br />
If m = "P" Then<br />
<br />
Timer1.Enabled = False<br />
mscomm1.PortOpen = False<br />
<br />
TextBox1.Text = ""<br />
MsgBox("hidden number")<br />
<br />
<br />
Else<br />
<br />
r = r.Substring(123, 7)<br />
<br />
<br />
<br />
End If<br />
there:<br />
<br />
Timer1.Enabled = False<br />
<br />
mscomm1.PortOpen = False<br />
<br />
TextBox1.Text = ""<br />
<br />
msgbox("Call number : " & r )<br />
<br />
Catch ex As Exception<br />
<br />
End Try<br />
End Sub<br />
|
|
|
|
|
I am trying to bind a picturebox (and its associated picture) into a MS Access dB. I have been reviewing several snippets of code but each seem to confuse me more. I have everything working properly in regards to data binding textboxes but the picturebox is going easily.
I want to be able to bring up an openfiledialog box (from a browse button), browse for the image (jpg, bmp, tif, gif) and then scale it to the picture box size and allow the picturebox to adjust itself for portrait or landscale layout. Then I want my already existing save button to bind the picturebox with the rest of the data to an MS Access database.
Any help would be greatly appreciated! Thank you!!
Jason
I'd rather have a bottle in front of me than a frontal lobotomy.
|
|
|
|
|