|
Just checking that Word, Excel and that lot is installed isn't quite what I want to do. If you go into Add/Remove programs can click Change on MS Office and then select add or remove components, you can see a listing of all the sub-components (ie. .NET programability support in Office 2003, or Mail Merge templates). Basically I want to check that all of this is installed during my programs installation.
|
|
|
|
|
I want VB.Net 2005 to pause for x amount of seconds then continue on. I've tried the System.Threading.Thread.Sleep(xxxx) method and that sort of works. If I have multiple threads in there it seems to pause the combine time of the Sleep method & only execute the last line.
For example:
<br />
Label6.Text = "On!!!"<br />
System.Threading.Thread.Sleep(3000)<br />
Label6.Text = "Off!!!"<br />
System.Threading.Thread.Sleep(3000)<br />
Label6.Text = "Something else!!!"<br />
only nets me "Something else!!!" 6 seconds later. There has to be a clean way to do this.
|
|
|
|
|
You'll probably need to call Application.DoEvents to give the UI a chance to refresh before you suspend it's thread.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
Yup, that did it!!
Thanks much, Ed!!
|
|
|
|
|
How do I establish connection to a worksheet in excel and convert the worksheet to a table in access2000 database using the VB 6.0
Fikunmi Feyijin
Hicad Systems
Nigeria
|
|
|
|
|
There is a COM library for accessing Word, Excel, Access databases etc. Just add a reference or component or what-ever it's called in VB6 and it should be pretty obvious from there on (sorry havn't used VB6 for 2 years or so but I do remember playing around with it).
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
I am trying to write a piece of code that spawns a window when the user presses both mouse buttons simultaneously.
I have been thinking the only way to do this would be to have two mouse hooks, watching for left and right clicks respectively, and checking the time difference between clicks. It would then cancel the message if the time is within a certain interval, and show the window.
Any better ideas? Please?
All your source are belong to us!
|
|
|
|
|
The easiest way would be to handle the click event and check the state of the buttons inside the event. The following will close the form if both buttons are depressed:
Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e _<br />
As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick<br />
If e.Button = Windows.Forms.MouseButtons.Left Then<br />
If MouseButtons = Windows.Forms.MouseButtons.Right Then<br />
Me.Close()<br />
End If<br />
End If<br />
If e.Button = Windows.Forms.MouseButtons.Right Then<br />
If MouseButtons = Windows.Forms.MouseButtons.Left Then<br />
Me.Close()<br />
End If<br />
End If<br />
End Sub<br />
Hope this helps.
Keith
|
|
|
|
|
There would be no form present when watching for mouse clicks. This is why I have suggested using a mouse hook.
All your source are belong to us!
|
|
|
|
|
I have a form that has ftp information entered and the program connected to the website. The next time a user starts the program, I want that info to be in a pull down for them to select. Eventully, the pulldown will have several websites ftp info stored in them. I was thinking of storing the info in an xml file but I realize this is not very secure. Is there a better way to store this information.
Almerica
|
|
|
|
|
Just encrypt the sensitive data. The only problem then is encrypting the encryption keys, and encrypting the encrypted encryption keys......
It's all a balance of how much security you need but the .NET Framework's System.Security.Cryptography namespace will help you out, there are assymetric and symmetric algorithms there including RSA and TripleDES.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
Hi there.
You can either save the information in the registry or in a XML file, but you should incript the data to make in more secure. There is DLL's and source code available to encode and decode data. For example CryptoAPI.cls. This is a VB6 based class module that I use to encrypt data.
Hope this will help you in some way.
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
I am wondering what is an xml editor and if an application provide that, what can you do with it?
|
|
|
|
|
its edits xml files duh!! lol .. well u have to look up what xml is first.If u know xml(i doubt it) , an xml editor smartly allows u to edit xml files.For eg.
if u have this piece of xml in an xml file
<question status="answered"> What is XML?</question>
normally u could just edit it in notepad , but an xml edit would allow u to 'smartly' edit the file as in it would be able to change the value of status or the node value etc,, if what i'm sayin is bouncing of your head i really suggest reading something on what xml is.And its really helpful nowadays , a lot of things are based on XML.
Gideon
-- modified at 2:44 Sunday 16th July, 2006
|
|
|
|
|
hey sorry but i did'nt know that xml example was'nt going to show up! the html parser took it off.So i modified the above message.
|
|
|
|
|
Hi
The first set of source code is the class for a combobox in a grid,
hopefully. In the second set of code we try to use the combobox class, but
the grid is empty.
I don't understand how this works. The first set of code I downloaded from
internet and when i tried it, it worked fine. But when I changed the second
part of the code it started to give me trouble. Before I changed the code
they used Datacolumns,Datarows and Datatables and added them to the Dataset
which they used to the Datagrid and it worked fine. I don't understand what
is wrong know that I'm using a table I haven't "made" myself but a table I
got from a connection. As the third set of code showing, when using
comboboxes you can set the Datasource to a table you have connected to with
a connection and it works fine, so I think the second part of code should
work, but the grid is empty when the program starts.
If there is anyone who understand my problem and have a solution, please
give me an answer.
Thanks
Fia
'The MyComboColumn class
Imports System.Data
Imports System.Drawing
Imports System.Collections
Imports System.Windows.Forms
Namespace ComboBoxTest
Public Class MyComboColumn
Inherits System.Windows.Forms.DataGridTextBoxColumn
Private _cboColumn As ComboBox
Private _objSource As Object
Private _strMember As String
Private _strValue As String
Private _bIsComboBound As Boolean = False
Private _backBrush As Brush = Nothing
Private _foreBrush As Brush = Nothing
Private _iRowNum As Integer
Private _cmSource As CurrencyManager
Public Sub New(ByVal objSource As DataSet, ByVal strMember As String, ByVal
strValue As String, ByVal bUseDropDownList As Boolean)
'_objSource = objSource
_strMember = strMember
_strValue = strValue
_cboColumn = New ComboBox
_cboColumn.DataSource = objSource.Tables(0)
_cboColumn.DisplayMember = _strMember
_cboColumn.ValueMember = _strValue
If bUseDropDownList = True Then
_cboColumn.DropDownStyle = ComboBoxStyle.DropDownList
Me.ReadOnly = True
Else
'AddHandler _cboColumn.KeyPress, AddressOf _cboColumn_KeyPress
AddHandler _cboColumn.KeyUp, AddressOf _cboColumn_KeyUp
End If
AddHandler _cboColumn.Leave, AddressOf cboColumn_Leave
_cboColumn.Visible = False
End Sub
Private Sub _cboColumn_KeyPress(ByVal sender As Object, ByVal e As
KeyPressEventArgs)
e.Handled = True
End Sub
Private Shadows Sub _cboColumn_KeyUp(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs)
Dim index As Integer
Dim actual As String
Dim found As String
' Do nothing for certain keys such as navigation keys
If ((e.KeyCode = Keys.Back) Or _
(e.KeyCode = Keys.Left) Or _
(e.KeyCode = Keys.Right) Or _
(e.KeyCode = Keys.Up) Or _
(e.KeyCode = Keys.Delete) Or _
(e.KeyCode = Keys.Down) Or _
(e.KeyCode = Keys.PageUp) Or _
(e.KeyCode = Keys.PageDown) Or _
(e.KeyCode = Keys.Home) Or _
(e.KeyCode = Keys.ShiftKey) Or _
(e.KeyCode = Keys.End)) Then
Return
End If
' Store the actual text that has been typed
actual = _cboColumn.Text
' Find the first match for the typed value
index = _cboColumn.FindString(actual)
' Get the text of the first match
If (index > -1) Then
found = _cboColumn.Items(index).ToString()
' Select this item from the list
_cboColumn.SelectedIndex = index
' Select the portion of the text that was automatically
' added so further typing will replace it
_cboColumn.SelectionStart = actual.Length
_cboColumn.SelectionLength = found.Length
End If
End Sub
Protected Overloads Overrides Sub Edit(ByVal source As CurrencyManager,
ByVal rowNum As Integer, ByVal bounds As Rectangle, ByVal [ReadOnly] As
Boolean, ByVal instantText As String, ByVal cellIsVisible As Boolean)
If _bIsComboBound = False Then
_bIsComboBound = True
Me.DataGridTableStyle.DataGrid.Controls.Add(_cboColumn)
End If
_iRowNum = rowNum
_cmSource = source
_cboColumn.Font = Me.TextBox.Font
Dim anObj As Object = Me.GetColumnValueAtRow(source, rowNum)
_cboColumn.Bounds = bounds
_cboColumn.BeginUpdate()
_cboColumn.Visible = True
If Not (anObj.GetType Is System.DBNull.Value) Then
'TextObject Is System.DBNull.Value
_cboColumn.SelectedValue = anObj
Else
_cboColumn.SelectedIndex = 0
End If
_cboColumn.EndUpdate()
_cboColumn.Focus()
End Sub
Public Sub cboColumn_Leave(ByVal sender As Object, ByVal e As EventArgs)
Dim objValue As Object = _cboColumn.SelectedValue
If objValue Is Nothing Then
objValue = DBNull.Value
Else
Me.SetColumnValueAtRow(_cmSource, _iRowNum, objValue)
End If
_cboColumn.Visible = False
End Sub
Protected Overloads Overrides Sub Paint(ByVal g As Graphics, ByVal bounds As
Rectangle, ByVal source As CurrencyManager, ByVal rowNum As Integer, ByVal
backBrush As Brush, ByVal foreBrush As Brush, ByVal alignToRight As Boolean)
Dim strCountry As String = "Huh?"
Dim aRowA As DataRow()
Dim anObj As Object = Me.GetColumnValueAtRow(source, rowNum)
Dim aType As Type = anObj.GetType
If Not (aType.GetType Is System.DBNull.Value) Then
aRowA = CType(_objSource, DataTable).Select(_strValue + " = " +
anObj.ToString)
Else
aRowA = CType(_objSource, DataTable).Select
End If
If aRowA.Length > 0 Then
strCountry = aRowA(0)(_strMember).ToString
End If
Dim rect As Rectangle = bounds
Dim rectF As RectangleF = rectF.op_Implicit(rect) ' Convert to
If Me._backBrush Is Nothing Then
g.FillRectangle(backBrush, rect)
Else
g.FillRectangle(_backBrush, rect)
End If
rect.Y += 2
If Me._foreBrush Is Nothing Then
'g.DrawString(Text, Me.DataGridTableStyle.DataGrid.Font, ForeBrush, RectF,
Format)
g.DrawString(strCountry, Me.TextBox.Font, foreBrush, rectF)
Else
g.DrawString(strCountry, Me.TextBox.Font, _foreBrush, rectF)
End If
End Sub
Public WriteOnly Property backgroundColour() As System.Drawing.Color
Set(ByVal Value As System.Drawing.Color)
If Value.Equals(System.Drawing.Color.Transparent) Then
Me._backBrush = Nothing
Else
Me._backBrush = New SolidBrush(Value)
End If
End Set
End Property
Public WriteOnly Property foregroundColour() As System.Drawing.Color
Set(ByVal Value As System.Drawing.Color)
If Value.Equals(System.Drawing.Color.Transparent) Then
Me._foreBrush = Nothing
Else
Me._foreBrush = New SolidBrush(Value)
End If
End Set
End Property
End Class
End Namespace
----------------------------------------------------------------------------
----------------------------------------------------------------------------
------------------------------------
'The Form's class
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms
Imports ReceptNet.ComboBoxTest
Public Class DataGridSample
Inherits Form
Private ds As DataSet
Private myGrid As DataGrid
Shared Sub Main()
Application.Run(New DataGridSample)
End Sub
Private Sub ConnectToData()
Dim AppPath As String = Replace(Replace(Application.ExecutablePath,
Application.ProductName + ".exe", ""), Application.ProductName + ".exe", "")
& "Recept.mdb"
Dim cString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
AppPath
Dim cn As System.Data.OleDb.OleDbConnection = New
System.Data.OleDb.OleDbConnection(cString)
Dim adpTables As System.Data.OleDb.OleDbDataAdapter = New
System.Data.OleDb.OleDbDataAdapter
adpTables.TableMappings.Add("Table", "Kött")
cn.Open()
Dim cmdTable As OleDb.OleDbCommand = New OleDb.OleDbCommand("SELECT * FROM
Kryddor", cn)
cmdTable.CommandType = CommandType.Text
adpTables.SelectCommand = cmdTable
ds = New DataSet("Customers")
adpTables.Fill(ds)
cn.Close()
Dim GridTableStyle As DataGridTableStyle = New DataGridTableStyle
GridTableStyle.MappingName = "Kött"
Me.myGrid.TableStyles.Add(GridTableStyle)
AddStyle(myGrid,ds)
End Sub
Private Sub AddStyle(ByVal grdSrc As DataGrid, ByVal dataS As DataSet)
Dim aCboCol As MyComboColumn = New MyComboColumn(dataS, "KöttID", "", False)
aCboCol.Width = 129
aCboCol.MappingName = "KöttID"
aCboCol.HeaderText = "Kött"
myGrid.TableStyles("Kött").GridColumnStyles.Add(aCboCol)
End Sub
Private Sub DataGridSample_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ConnectToData()
End Sub
End Class
----------------------------------------------------------------------------
----------------------------------------------------------------------------
------------------------------------
Me.cboDatum.DataSource = ds.Tables(1)
cboDatum.DisplayMember = "KöttID"
cboDatum.ValueMember = ""
|
|
|
|
|
How can use DataGrid .... so that i would like to fill it from database after that i would like to change the values of it then i would like to view report with new data that i filled from DataGrid.
|
|
|
|
|
Hallo ,
i think this is help you.
http://www.codeproject.com/csharp/webservicecache.asp
Regards Thomas
|
|
|
|
|
I want to move form with control label on the form, can anyone help me?
Thanks
................
|
|
|
|
|
Uhhh.... What?
Are you asking how to move a form by holding the mouse button down on a control on the form??
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have code for that.
Put this at the top of your form class(in the declarations area):
Private Declare Function ReleaseCapture Lib "user32" () As Integer
'UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSExpressCC.v80/dv_commoner/local/redirect.htm?keyword="FAE78A8D-8978-4FD4-8208-5B7324A8F795"'
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByRef lParam As Integer) As Integer
Private Const HTCAPTION As Short = 2
Private Const WM_NCLBUTTONDOWN As Short = &HA1S
Private Const WM_SYSCOMMAND As Short = &H112S
And put this in the label_mousedown sub:
Dim Button As Short = Button \ &H100000
Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
Dim X As Single = (X)
Dim Y As Single = (Y)
ReleaseCapture()
SendMessage(Handle.ToInt32, WM_NCLBUTTONDOWN, HTCAPTION, 0)
Now when you hold the mouse down on that label, you will be able to move the form around.
Posted by The ANZAC
-- modified at 22:53 Friday 14th July, 2006
|
|
|
|
|
Even Better:
Put this at the top of your form class(in the declarations area):
Private Declare Function ReleaseCapture Lib "user32" () As Integer
'UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported. Click for more: 'ms-help://MS.VSExpressCC.v80/dv_commoner/local/redirect.htm?keyword="FAE78A8D-8978-4FD4-8208-5B7324A8F795"'
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByRef lParam As Integer) As Integer
But Put the rest in a public sub named MoveForm:
Dim Button As Short = Button \ &H100000
Dim Shift As Short = System.Windows.Forms.Control.ModifierKeys \ &H10000
Dim X As Single = (X)
Dim Y As Single = (Y)
ReleaseCapture()
SendMessage(Handle.ToInt32, WM_NCLBUTTONDOWN, HTCAPTION, 0)
And in your label_MouseDown Sub call the MoveForm Sub:
Posted by The ANZAC
|
|
|
|
|
You might want to reply to the orignal poster with this. That way, he gets the email message that you replied to HIS post.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
How do you make your program run other executable programs, i have tried open but it doesn't work. I tried to structure a process, but am not sure how to do it properly.
I am using Visual Basic 2005 Express Edition (Version 8). The executable is called "Install.exe" but the method i used to locate it holds it in a sttring called objFile.
Thankyou in advance.
Posted by The ANZAC
|
|
|
|
|
Call Process.Start(...) method. For more info, check this[^] out.
Best,
Jun
|
|
|
|
|