|
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
|
|
|
|
|
I have the following two functions. My goal is to highlight a row in a
datagrid and delete a row. Problem arises when I click on the delete button.
Below are two sub routines for DoDelete. Which route should I go with?
I have created stored procedure for deleting the row as well.
Any help would be greatful.
Private Sub highLightRow(ByVal sender As Object, ByVal e As MouseEventArgs)
Dim pt = New Point(e.X, e.Y)
Dim grd As DataGrid = CType(sender, DataGrid)
Dim hit As DataGrid.HitTestInfo = grd.HitTest(pt)
If hit.Type = grd.HitTestType.Cell Then
grd.CurrentCell = New DataGridCell(hit.Row, hit.Column)
RowNum = hit.Row
grd.Select(RowNum)
PolicyNumber = Convert.ToString(grd.Item(RowNum, 1))
TransCodeOrig = Convert.ToString(grd.Item(RowNum, 2))
TransEffDate = Convert.ToString(grd.Item(RowNum, 3))
ModifiedUID = Convert.ToString(grd.Item(RowNum, 7))
End If
End Sub
Public Sub DoDelete()
Dim bm As BindingManagerBase = Me.DataGrid1.BindingContext(Me.DataGrid1.DataSource, Me.DataGrid1.DataMember)
Dim dr As DataRow = CType(bm.Current, DataRowView).Row
Try
PolicyNumber = dr(1)
TransCodeOrig = dr(2)
TransEffDate = dr(3)
ModifiedUID = dr(7)
dr.Delete()
DsTransOverride1.dbo_stp_SelTransOverrides.Clear()
SqlDataAdapter1.Fill(DsTransOverride1.dbo_stp_SelTransOverrides)
' SqlDataAdapter1.Update(Me.DsTransOverride1, "dbo_stp_SelTransOverrides")
DsTransOverride1.dbo_stp_SelTransOverrides.AcceptChanges()
Me.lbNumRec.Text = Me.DsTransOverride1.Tables(0).Rows.Count.ToString()
Catch exError As Exception
MessageBox.Show(exError.Message)
End Try
End Sub
Public Sub doDelete()
' MDI Main Delete record requ3est toolbar button pressed
'if no records are displayed on the grid exist then exit
Dim ConnectionString As String = System.Configuration.ConfigurationSettings.AppSettings("FinSolMainDBConn")
Dim connfinsol As New System.Data.SqlClient.SqlConnection(ConnectionString)
Dim myCommand As New SqlCommand("stp_DelTransOverride ", connfinsol)
myCommand.CommandType = CommandType.StoredProcedure
'Add Parameters
' 1 Policy Number
myCommand.Parameters.Add("@Policy_Nbr", SqlDbType.VarChar, 7).Value = PolicyNumber
' 2 Original Tranaction Override
myCommand.Parameters.Add("@Trans_CodeOrig", SqlDbType.VarChar, 6).Value = TransCodeOrig
' 3 Transaction Effective Date
myCommand.Parameters.Add("@Trans_Eff_Date", SqlDbType.DateTime, 8).Value = TransEffDate
' 8 Modified UID
myCommand.Parameters.Add("@ModifiedUID", SqlDbType.NVarChar, 48).Value = ModifiedUID
'Open Connection
Try
'Open Connection
connfinsol.Open()
myCommand.ExecuteNonQuery()
MsgBox("Data Deleted Successfully !", MsgBoxStyle.Information, Me.Text)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, Me.Text)
Finally
If myCommand.Connection.State = ConnectionState.Open Then
myCommand.Connection.Close()
End If
End Try
End Sub
I am not sure where to go, which DoDelete do go with.
Any help would be appreciated.
|
|
|
|
|
ok i hope this helps.
<asp:datagrid id="dgResults" runat="server" width="100%" autogeneratecolumns="False" ondeletecommand="dgResults_Delete" datakeyfield="form_id">
<alternatingitemstyle backcolor="#C0C0FF">
<itemstyle backcolor="#8080FF">
<headerstyle backcolor="Gainsboro">
<columns>
<asp:boundcolumn datafield="form_id" headertext="Form ID"><headerstyle width="65px">
<asp:boundcolumn datafield="hazard" headertext="Hazard Name">
<asp:boundcolumn datafield="description" headertext="Hazard Description">
<asp:buttoncolumn text="Delete Form" buttontype="LinkButton" commandname="delete">
<headerstyle width="80px">
this is the datagrid that i used in a recent project add this or something similar to the html.Make sure to add the onDeleteCommand & DataKeyField(this is the id of a column in your database).
then add the following to the code behind page.
Sub dgResults_Delete(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)
Dim Selectedform_id As String = dgResults.DataKeys(E.Item.ItemIndex)
conn.Open()
Try
Dim command As New SqlCommand("DeleteForm", conn)
command.CommandType = CommandType.StoredProcedure
command.Parameters.Add("@form_id", dgResults.DataKeys(E.Item.ItemIndex))
command.Parameters.Add("@form_id", dgResults.DataKeys(E.Item.ItemIndex))
Finally
conn.Close
End Try
''write statement to rebind the datgrid once deleted. Also notice that i used a stored procedure to delete the details in the database.
Hope this is helpful if not give me another shout.
gfhg
|
|
|
|
|
Gah help, I'm going crazy. Yet another one of those late night programming sessions to meet a deadline.
And I'm stuck on the silliest of silly bugs.
A small piece of code to insert an error message into a table.
The stored procedure:
CREATE PROCEDURE dbo.sp_ServiceLog <br />
@Description nchar(100)<br />
AS<br />
INSERT INTO ServiceLog (dtstamp,Description)<br />
VALUES<br />
(GetDate(), @Description)<br />
GO
The vb code to insert it:
Dim c As New OdbcCommand("sp_ServiceLog", cnn)<br />
c.CommandType = Data.CommandType.StoredProcedure<br />
Dim p1 As New OdbcParameter("@Description", OdbcType.NChar, 100)<br />
p1.Value = _message<br />
c.Parameters.Add(p1)
But everytime its run, the following error appears:
ServiceLog Insert: ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure 'sp_ServiceLog' expects parameter '@Description', which was not supplied.
Can anyone spot the mistake?
plzzzzzzzz
|
|
|
|
|
I have created an application which on connecting to outlook iterates through the mapifolders and pulls messages out of the store. On various occasions the outlook object will fail to connect to an Outlook folder, this failure then caches and reconnecting to this folder requires Outlook.exe to be restarted. Tighter object handling and setting folder objects to Nothing minimises this but I have been unable to remove it entirely. Different connection modes also minimises this, however the connection mode is a read-only property and I am unable to set it at the application level. Any suggestions?
|
|
|
|
|
I am trying to dynamically change the size of a form at run time. I am finding that if I change it to say 1400, it actually resets the height to a height of 1212. Does anyone know why I might be seeing this type of magic?
|
|
|
|
|
What code are you using to set the size of the form, then read back the size? It sounds like your setting the height of the entire form to 1400, then just looking at the heigh of its client area.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I am simply settingteh height based on a configuration. The actual code is something liek this:
frmLot.DefInstance.Height = (lblslots(1).Height * Rows) + + (id(1).Height * Rows) + (600) ' / hf)
If I do the math with an instant watch it comes up to 1400. When I execute the line and look at the height it shows 1212 even though the formula works out to 1400 in the instant watch window. In my watch window I can change it to anything under 1212.
|
|
|
|
|
How do you hide a tabPage within a tabcontrol?
There is no visible property in the tabPage properties
-- modified at 15:01 Wednesday 7th September, 2005
|
|
|
|
|
You can't. (Microsoft control design is pretty stupid sometimes).
There are several workarounds. If you don't mind the tabpage itself still being visible, you can either set all the controls on the tabpage to invisible, or better still, put all the controls on a tabpage on a Panel and set the Panel to invisible.
If you want tab pages to be visible or not visible, what you can do is store a copy of ecxah tab page in a form level collection. Then you can delete the tab page from the Tab Control's TabPages collection, and later restore it from a copy you saved in the form level collection.
|
|
|
|
|
I cannot see the property visible for tabpages within tabcontrol?
Or what is the syntax to make a tabpage invisible or visible.
|
|
|
|
|