|
Hi
In vb6 I want to have an activex-exe file that the user can also run it as an ordinary executable file. So I put a Sub Main() in that which loads the GUI. But a new problem raises here, which is when I am going to create an instance of any class in that activex-exe, the Sub Main() runs before the Class_Initialize() and the GUI also is shown (which is not what I want when creating an instance of the class).
How could I overcome this problem?
|
|
|
|
|
I would have a separate EXE for this purpose which uses the ActiveX EXE to expose the functions to a GUI. Don't try to make the ActiveX EXE serve two purposes.
...Steve
|
|
|
|
|
hi,every one:
i write a program to scan a special folder every 10 second.so i drag a timer control to the from. and in timer1_tick sub i write some code.it work very well under by windos xp system. but when i put the program onto another server(system is windows 2003 server),i found the timer control is NOT run,even 1 time.
so i delete the timer control,create a threading.timer object used code under:
dim tmr as threading.timer=new threading.timer(new threading.timercallback(addressof timerproc,vbnull,0,10000)
i found the sub NOT work still.
help,what's the matter?
thx.
|
|
|
|
|
|
Hey, you only left this message a few hours ago. Don't be impatient. If you want instant response I'm sure that there are many consultants that would be willing to help for a fee Remember this is a free site.
As to your question, if you can post the code which you are using we can have a look see at what the problem might be.
...Steve
|
|
|
|
|
following is the code. there is some chinese words,but it is not important. and i give the mainly meaning . thanks for help me! i can't find error in it.
Public Class Form1<br />
<br />
Inherits System.Windows.Forms.Form<br />
Dim PathString As String = System.Windows.Forms.Application.StartupPath & "\", PL() As PlugStructure<br />
Dim StartTime As Date = Now<br />
Dim Tcb As Threading.TimerCallback<br />
Dim Tmr As Threading.Timer<br />
<br />
Structure PlugStructure<br />
Dim Name As String<br />
Dim Guid As String<br />
Dim Status As PlugStatus<br />
Dim Ins As PlugIns.piInterface<br />
Dim Tab As TabPage<br />
Dim Txt As TextBox<br />
End Structure<br />
<br />
Enum PlugStatus<br />
Loaded = 0<br />
Starting = 1<br />
Running = 2<br />
Stopping = 3<br />
Stopped = 4<br />
Unloaded = 5<br />
End Enum<br />
<br />
#Region " Windows 窗体设计器生成的代码 " ' this means code generation by windows form designer<br />
<br />
Public Sub New()<br />
MyBase.New()<br />
<br />
InitializeComponent()<br />
<br />
End Sub<br />
<br />
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)<br />
If disposing Then<br />
If Not (components Is Nothing) Then<br />
components.Dispose()<br />
End If<br />
End If<br />
MyBase.Dispose(disposing)<br />
End Sub<br />
<br />
Private components As System.ComponentModel.IContainer<br />
<br />
Friend WithEvents TabControl1 As System.Windows.Forms.TabControl<br />
Friend WithEvents TabPage1 As System.Windows.Forms.TabPage<br />
Friend WithEvents TxtMain As System.Windows.Forms.TextBox<br />
Friend WithEvents RightClick As System.Windows.Forms.ContextMenu<br />
Friend WithEvents NotifyIcon1 As System.Windows.Forms.NotifyIcon<br />
Friend WithEvents ShowMain As System.Windows.Forms.MenuItem<br />
Friend WithEvents NoUse As System.Windows.Forms.MenuItem<br />
Friend WithEvents EndProgram As System.Windows.Forms.MenuItem<br />
Friend WithEvents PnlRunTime As System.Windows.Forms.StatusBarPanel<br />
Friend WithEvents PnlRoundTimes As System.Windows.Forms.StatusBarPanel<br />
Friend WithEvents PnlPlugIns As System.Windows.Forms.StatusBarPanel<br />
Friend WithEvents STBInfo As System.Windows.Forms.StatusBar<br />
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()<br />
Me.components = New System.ComponentModel.Container<br />
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))<br />
Me.TabControl1 = New System.Windows.Forms.TabControl<br />
Me.TabPage1 = New System.Windows.Forms.TabPage<br />
Me.TxtMain = New System.Windows.Forms.TextBox<br />
Me.RightClick = New System.Windows.Forms.ContextMenu<br />
Me.ShowMain = New System.Windows.Forms.MenuItem<br />
Me.NoUse = New System.Windows.Forms.MenuItem<br />
Me.EndProgram = New System.Windows.Forms.MenuItem<br />
Me.NotifyIcon1 = New System.Windows.Forms.NotifyIcon(Me.components)<br />
Me.STBInfo = New System.Windows.Forms.StatusBar<br />
Me.PnlRunTime = New System.Windows.Forms.StatusBarPanel<br />
Me.PnlRoundTimes = New System.Windows.Forms.StatusBarPanel<br />
Me.PnlPlugIns = New System.Windows.Forms.StatusBarPanel<br />
Me.TabControl1.SuspendLayout()<br />
CType(Me.PnlRunTime, System.ComponentModel.ISupportInitialize).BeginInit()<br />
CType(Me.PnlRoundTimes, System.ComponentModel.ISupportInitialize).BeginInit()<br />
CType(Me.PnlPlugIns, System.ComponentModel.ISupportInitialize).BeginInit()<br />
Me.SuspendLayout()<br />
'<br />
'TabControl1<br />
'<br />
Me.TabControl1.Appearance = System.Windows.Forms.TabAppearance.FlatButtons<br />
Me.TabControl1.Controls.Add(Me.TabPage1)<br />
Me.TabControl1.Location = New System.Drawing.Point(24, 16)<br />
Me.TabControl1.Name = "TabControl1"<br />
Me.TabControl1.SelectedIndex = 0<br />
Me.TabControl1.Size = New System.Drawing.Size(648, 24)<br />
Me.TabControl1.TabIndex = 0<br />
'<br />
'TabPage1<br />
'<br />
Me.TabPage1.Location = New System.Drawing.Point(4, 24)<br />
Me.TabPage1.Name = "TabPage1"<br />
Me.TabPage1.Size = New System.Drawing.Size(640, 0)<br />
Me.TabPage1.TabIndex = 0<br />
Me.TabPage1.Tag = "Main"<br />
Me.TabPage1.Text = "Main Form"<br />
'<br />
'TxtMain<br />
'<br />
Me.TxtMain.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _<br />
Or System.Windows.Forms.AnchorStyles.Left) _<br />
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)<br />
Me.TxtMain.Location = New System.Drawing.Point(24, 40)<br />
Me.TxtMain.Multiline = True<br />
Me.TxtMain.Name = "TxtMain"<br />
Me.TxtMain.ReadOnly = True<br />
Me.TxtMain.Size = New System.Drawing.Size(648, 184)<br />
Me.TxtMain.TabIndex = 0<br />
Me.TxtMain.Text = ""<br />
'<br />
'RightClick<br />
'<br />
Me.RightClick.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.ShowMain, Me.NoUse, Me.EndProgram})<br />
'<br />
'ShowMain<br />
'<br />
Me.ShowMain.DefaultItem = True<br />
Me.ShowMain.Index = 0<br />
Me.ShowMain.Text = "Show Me"<br />
'<br />
'NoUse<br />
'<br />
Me.NoUse.Index = 1<br />
Me.NoUse.Text = "-"<br />
'<br />
'EndProgram<br />
'<br />
Me.EndProgram.Index = 2<br />
Me.EndProgram.Text = "Quit"<br />
'<br />
'NotifyIcon1<br />
'<br />
Me.NotifyIcon1.ContextMenu = Me.RightClick<br />
Me.NotifyIcon1.Icon = CType(resources.GetObject("NotifyIcon1.Icon"), System.Drawing.Icon)<br />
Me.NotifyIcon1.Text = "AutoTask"<br />
Me.NotifyIcon1.Visible = True<br />
'<br />
'STBInfo<br />
'<br />
Me.STBInfo.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _<br />
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)<br />
Me.STBInfo.Dock = System.Windows.Forms.DockStyle.None<br />
Me.STBInfo.Enabled = False<br />
Me.STBInfo.Location = New System.Drawing.Point(0, 232)<br />
Me.STBInfo.Name = "STBInfo"<br />
Me.STBInfo.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.PnlRunTime, Me.PnlRoundTimes, Me.PnlPlugIns})<br />
Me.STBInfo.ShowPanels = True<br />
Me.STBInfo.Size = New System.Drawing.Size(696, 22)<br />
Me.STBInfo.TabIndex = 1<br />
Me.STBInfo.Text = "StatusBar1"<br />
'<br />
'PnlRunTime<br />
'<br />
Me.PnlRunTime.Alignment = System.Windows.Forms.HorizontalAlignment.Center<br />
Me.PnlRunTime.Icon = CType(resources.GetObject("PnlRunTime.Icon"), System.Drawing.Icon)<br />
Me.PnlRunTime.Text = "0D 0H 0M"<br />
Me.PnlRunTime.Width = 90<br />
'<br />
'PnlRoundTimes<br />
'<br />
Me.PnlRoundTimes.Alignment = System.Windows.Forms.HorizontalAlignment.Center<br />
Me.PnlRoundTimes.Icon = CType(resources.GetObject("PnlRoundTimes.Icon"), System.Drawing.Icon)<br />
Me.PnlRoundTimes.Text = "0"<br />
Me.PnlRoundTimes.Width = 80<br />
'<br />
'PnlPlugIns<br />
'<br />
Me.PnlPlugIns.Icon = CType(resources.GetObject("PnlPlugIns.Icon"), System.Drawing.Icon)<br />
Me.PnlPlugIns.MinWidth = 1<br />
Me.PnlPlugIns.Width = 510<br />
'<br />
'Form1<br />
'<br />
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)<br />
Me.ClientSize = New System.Drawing.Size(696, 254)<br />
Me.Controls.Add(Me.STBInfo)<br />
Me.Controls.Add(Me.TabControl1)<br />
Me.Controls.Add(Me.TxtMain)<br />
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)<br />
Me.MaximizeBox = False<br />
Me.MinimizeBox = False<br />
Me.Name = "Form1"<br />
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen<br />
Me.Text = "AutoTask"<br />
Me.TabControl1.ResumeLayout(False)<br />
CType(Me.PnlRunTime, System.ComponentModel.ISupportInitialize).EndInit()<br />
CType(Me.PnlRoundTimes, System.ComponentModel.ISupportInitialize).EndInit()<br />
CType(Me.PnlPlugIns, System.ComponentModel.ISupportInitialize).EndInit()<br />
Me.ResumeLayout(False)<br />
<br />
End Sub<br />
<br />
#End Region<br />
<br />
Private Sub TimerProc(ByVal state As Object)<br />
Tmr.Change(Threading.Timeout.Infinite, Threading.Timeout.Infinite)<br />
....<br />
Tmr.Change(10000, 10000)<br />
End Sub<br />
<br />
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Tcb = New Threading.TimerCallback(AddressOf TimerProc)<br />
Tmr = New Threading.Timer(Tcb, vbNull, 1000, 10000)<br />
Me.NotifyIcon1.Visible = True<br />
Me.WindowState = FormWindowState.Minimized<br />
Me.ShowInTaskbar = False<br />
LogMain("Program Start at:" & PathString)<br />
End Sub<br />
<br />
Private Sub LogMain(ByVal S As String)<br />
Me.TxtMain.Text = Now & ": " & S & vbCrLf & Me.TxtMain.Text<br />
End Sub<br />
<br />
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged<br />
Dim t As TextBox<br />
For Each t2 As Object In Me.Controls<br />
If Equals(t2.GetType, GetType(TextBox)) Then<br />
t = CType(t2, TextBox)<br />
If t.Name <> "Txt" & Me.TabControl1.SelectedTab.Tag Then<br />
t.Visible = False<br />
Else<br />
t.Visible = True<br />
End If<br />
End If<br />
Next<br />
End Sub<br />
<br />
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing<br />
e.Cancel = True<br />
Me.WindowState = FormWindowState.Minimized<br />
Me.ShowInTaskbar = False<br />
Me.NotifyIcon1.Visible = True<br />
End Sub<br />
<br />
Private Sub EndProgram_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles EndProgram.Click<br />
If Not PL Is Nothing Then<br />
For i As Integer = 0 To PL.GetUpperBound(0)<br />
PL(i).Ins.EndNow()<br />
Next<br />
End If<br />
Me.NotifyIcon1.Visible = False<br />
Tmr.Change(Threading.Timeout.Infinite, Threading.Timeout.Infinite)<br />
Tmr.Dispose()<br />
End<br />
End Sub<br />
<br />
Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick<br />
ShowMain_Click(sender, e)<br />
End Sub<br />
<br />
Private Sub ShowMain_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ShowMain.Click<br />
Me.WindowState = FormWindowState.Normal<br />
Me.ShowInTaskbar = True<br />
Me.NotifyIcon1.Visible = False<br />
End Sub<br />
<br />
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize<br />
If Me.STBInfo.Width > 300 Then Me.STBInfo.Panels(2).Width = Me.STBInfo.Width - Me.STBInfo.Panels(0).Width - Me.STBInfo.Panels(1).Width<br />
End Sub<br />
End Class
|
|
|
|
|
I'd make the following changes to the code:
1. delete the Tmr.Change() lines from your timer callback. They serve no purpose in the callback function.
2. Change this line:
Tmr = New Threading.Timer(Tcb, vbNull, 1000, 10000)
to this...
Tmr = New Threading.Timer(Tcb, Nothing, 1000, 10000)
because vbNull is not the same as Nothing in VB.
...Steve
|
|
|
|
|
thank you for reply again.
i write tmr.change in my timer callback procedure because i am afraid of this procedure will not finish in 10 second,i think this can prevent it.
and i accept the No.2
but the original problem is i'm using a system.windows.form.timer control,and it NOT work normal also. would you like explain the reason to me?following is the original code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick<br />
....<br />
End Sub
|
|
|
|
|
Silly question, but is the timer enabled (in my own form initialization code I have something like this):
Timer1.Enabled = False
Timer1.Interval = 2000
Timer1.Enabled = True
Another possibility is that the Timer control is designed only for use with forms. Is the form on which it appears always active? It could also be the version of the .NET Framework you have on the server vs the one you have compiled against on your workstation. Check that they match.
...Steve
|
|
|
|
|
i am not a proficient programmer,but i am not a beginner too.
"timer1.enable=true " has in form1_load already.
the form will minimized once it start,do this affect the timer and lead the timer deactive? if so,many question will occur...
and the timer is used in a winform,i am sure this.
No.3,both the server and my machine has the same version of .NET(1.1.4322).
sigh.....
|
|
|
|
|
woodwell wrote:
i am not a proficient programmer,but i am not a beginner too.
I'm not trying to be funny - sometimes the answers lie in the most simple of overlooked things.
Well assuming that the code works fine on your WinXP box and the same code does not work on Win2k3 Server (hazarding to state the obvious here...) there is something different about that environment.
Are there any error messages trapped by your code that could give us a clue? If not, ensure that the timer control OCX/DLL or whatever is actually on the server and registered. Also check that the service pack on your VB (Visual Studio .NET 200x?) is up to date.
...Steve
|
|
|
|
|
i know that. sorry for my misnomer.
this program work very well on my XP machine, no any error or warning message. but on Win2003 PRO server,it strike.
i remember one thing, two weeks ago, there is another program which used timer control too, run normal on this server. since i found this problem yesterday, i ask the administrator of our LAN, he said,the server has no any change for 2 months at least.
it looks that problem is base on two diffirent environment. i think so yesterday, but i has no resolvent.
|
|
|
|
|
Hello Folks!
I am developing one application in which I have to do the scanning of the document.I have implemented that through the imagescan.ocx control.I am able to scan the document but it is not displayed in the image edit control and it is not even showing any error.
I am a bit confused regarding this.
Can anybody help me out in this regard.
Waiting for your reply.
Thanking you.
Regards,
Krsna.
|
|
|
|
|
I've developed an application in VB6 to communicate with an RS232 device controled with motorola HC11. However one of the routines in my application needs to send and intel hex file to the motorola which it will process and load into flash memory for software upgrades. The HC11 is sending Xon/Xoff characters to indicate when its buffer is full but I can't seem to react quick enough with the mscomm control to prevent buffer overrun. It will work at a dreadfully slow pace but I need more speed. I know that mscomm has a handshaking property but I'm not sure how to use it to stop my data transfer. Any help would be appreciated.
|
|
|
|
|
Hi friends!
This might sound really elementary but i was just wondering how can i make sure that a user inputs an integer value. I've a textbox which has to be in integer format and when it is not, upon clicking the save button, my field validator should shows up and resets the textbox to "". I've tried this code but it doesn't seem to work...
If Cint(TextBox1.Text) = false then
RFV1.Validate()
TextBox1.Text = ""
Else
'does the saving
End If
It throws an exception that input string is not in correct format. How do i go about fixing this? Thanx to all!
Kampai!!!
|
|
|
|
|
Use a regex validator.
Or, Double has a TryParse method, but Int16, integer, etc. don't appear to. I'm sure some type without floating point supports it, though.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Regex...that's wat i'm afraid of...why do i have to do this in vb in the 1st place. Any recomendations for a good regex tutorial chris? Thanx for the reply by the way
Kampai!!!
|
|
|
|
|
The regular expression for a number is just ^\d+$
The best 'tutorial' is expresso, if you download that, you can test your regex in that. That's how I build mine.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
o yeah i've encounterd dat expresso b4...didnt take seriously though. once again thanx for ur help!
|
|
|
|
|
You have to do this in ANY language. Unless your using a TextBox component specifically written to accept number but integers.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Dear Sir
I program to change Font map on windows appearances, but it doesn't execute.
Could you help me to make it run
here is my code in VB6
//////////////////////////////////////////////////////////////
==============================================================
Public Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef LpvParam As Any, ByVal fuWinIni As Long) As Boolean
Public Const SPI_GetNonClientMetrics = 41
Public Const SPI_SetNonClientMetrics = 42
Public Const SPI_GetIconTitleLogFont = 31
Public Const SPI_SetIconTitleLogFont = 34
'---------------------------------------------------------------------------------------------------------------------------------
Public Type LogFont
LfHeight As Long
LfWidth As Long
LfEscapement As Long
LfOrientation As Long
LfWeight As Long
LfItalic As Byte
LfUnderLine As Byte
LfStrikeOut As Byte
LfCharSet As Byte
LfOutPrecision As Byte
LfQuanlity As Byte
LfPitchAndFamily As Byte
LfFaceName As String * 32
End Type
Public Type NonClientMetrics
cbSize As Long
iBorderWidth As Long
iScrollWidth As Long
iScrollHeight As Long
iCaptionWidth As Long
iCaptionHeight As Long
iCaptionFont As LogFont
iSmCaptionWidth As Long
iSmCaptionHeight As Long
iSmCaptionFont As LogFont
iMenuWidth As Long
iMenuHeight As Long
LfMenuFont As LogFont
LfStatus As LogFont
LfMessageFont As LogFont
LfCaptionFont As LogFont
LfSmCaptionFont As LogFont
End Type
'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Private m_NonClientMetrics As NonClientMetrics
Private m_LogFont As LogFont
'Khai bao cac bien chua so do font
Public m_FontCaption As String * 32
Public m_FontSmCaption As String * 32
Public m_FontMenu As String * 32
Public m_FontMessage As String * 32
Public m_FontStatus As String * 32
Public m_FontIcon As String * 32
'---------------------------------------------------------------------------------------------------------------------------
Public Sub SetSysFont(FontName As String)
On Error GoTo Err
m_NonClientMetrics.cbSize = Len(m_NonClientMetrics)
Ret = SystemParametersInfo(SPI_GetNonClientMetrics, Len(m_NonClientMetrics), m_NonClientMetrics, 0)
Ret = SystemParametersInfo(SPI_GetIconTitleLogFont, Len(m_LogFont), m_LogFont, 0)
m_FontCaption = m_NonClientMetrics.LfCaptionFont.LfFaceName
m_FontSmCaption = m_NonClientMetrics.LfSmCaptionFont.LfFaceName
m_FontMenu = m_NonClientMetrics.LfMenuFont.LfFaceName
m_FontMessage = m_NonClientMetrics.LfMessageFont.LfFaceName
m_FontStatus = m_NonClientMetrics.LfStatus.LfFaceName
m_FontIcon = m_LogFont.LfFaceName
With m_NonClientMetrics
.LfCaptionFont.LfFaceName = FontName & vbNullChar
.LfSmCaptionFont.LfFaceName = FontName & vbNullChar
.LfMenuFont.LfFaceName = FontName & vbNullChar
.LfMessageFont.LfFaceName = Trim(FontName) & vbNullChar
.LfStatus.LfFaceName = FontName & vbNullChar
End With
Ret = SystemParametersInfo(SPI_SetNonClientMetrics, Len(m_NonClientMetrics), m_NonClientMetrics, 0)
m_LogFont.LfFaceName = FontName & vbNullChar
Ret = SystemParametersInfo(SPI_SetIconTitleLogFont, Len(m_LogFont), m_LogFont, 0)
Exit Sub
Err:
MsgBox Err.Description
End Sub
'---------------------------------------------------------------------------------------------
Public Sub RestoreSysFont()
With m_NonClientMetrics
.LfCaptionFont.LfFaceName = m_FontCaption
.LfSmCaptionFont.LfFaceName = m_FontSmCaption
.LfMenuFont.LfFaceName = m_FontMenu
.LfMessageFont.LfFaceName = m_FontMessage
.LfStatus.LfFaceName = m_FontStatus
End With
Ret = SystemParametersInfo(SPI_SetNonClientMetrics, Len(m_NonClientMetrics), m_NonClientMetrics, 0)
Ret = SystemParametersInfo(SPI_SetIconTitleLogFont, Len(m_LogFont), m_LogFont, 0)
End Sub
'---------------------------------------------------------------------------------------------------------------------------
Public Sub Main()
SetSysFont (".Vntime")
frmVnTime.Show
End Sub
'--------------------------------------------------------------------------------------------------------------------
Private Sub Form_Unload(Cancel As Integer)
RestoreSysFont
End Sub
==============================================================
//////////////////////////////////////////////////////////////
Thank you !
|
|
|
|
|
I am trying to apply different FontStyles to text within a RichtextBox control that was dynamically created. For some reason I do not get the .Selection??? anything Methods on a dynamically created control. All I have been able to successfully do is all or nothing. Here is the code I have been working with:
Try<br />
If tsbBold.Checked = False Then<br />
tsbBold.Checked = True<br />
For Each ctl As Control In TabControl1.SelectedTab.Controls<br />
If TypeOf ctl Is RichTextBox Then<br />
Dim selBold As New Font(ctl.Font, FontStyle.Bold)<br />
ctl.Font = selBold<br />
End If<br />
Next<br />
ElseIf tsbBold.Checked = True Then<br />
tsbBold.Checked = False<br />
For Each ctl As Control In TabControl1.SelectedTab.Controls<br />
If TypeOf ctl Is RichTextBox Then<br />
Dim selNotBold As New Font(ctl.Font, FontStyle.Regular)<br />
ctl.Font = selNotBold<br />
End If<br />
Next<br />
End If<br />
Catch ex As Exception<br />
MessageBox.Show(MsgBoxStyle.Exclamation, "An error has occured. Please try your selection again")<br />
End Try
Any suggestions?
Thanks,
Taen Karth
|
|
|
|
|
Nevermind I figured out a way to work around it by using the following code.
Try<br />
If tsbBold.Checked = False Then<br />
tsbBold.Checked = True<br />
For Each ctl As Control In TabControl1.SelectedTab.Controls<br />
If TypeOf ctl Is RichTextBox Then<br />
Dim rtb As RichTextBox<br />
rtb = ctl<br />
Dim selBold As New Font(rtb.Font, FontStyle.Bold)<br />
rtb.SelectionFont = selBold<br />
End If<br />
Next<br />
ElseIf tsbBold.Checked = True Then<br />
tsbBold.Checked = False<br />
For Each ctl As Control In TabControl1.SelectedTab.Controls<br />
If TypeOf ctl Is RichTextBox Then<br />
Dim rtb As RichTextBox<br />
rtb = ctl<br />
Dim selNotBold As New Font(rtb.Font, FontStyle.Regular)<br />
rtb.SelectionFont = selNotBold<br />
End If<br />
Next<br />
End If<br />
Catch ex As Exception<br />
MessageBox.Show(MsgBoxStyle.Exclamation, "An error has occured. Please try your selection again")<br />
End Try
If there is a better or easier way please let me know.
Thanks,
Taen Karth
|
|
|
|
|
I need some guidance in making project setup .I have some steps which presently i am performing one by one. Like intsalling Mysql,Making it a window service. then installing the front end for mysql. running script file for database. making a dsn and then finally installing the project. I want all these things to be done by code as i am doing evrything manuaaly now. I am using innosetup for project setup.moreover i need to check whether .net framework and mysql is already installed or not. Can anyone guide me pls.
Thanks
Monica
|
|
|
|
|