|
hello
again i have a new problem which makes me crazy....how can i invoke other application like word,excel,acrobat and so on....coz in my case,,first i have to locate first the last 3 or 4 character to able for me get the specified file name like for example...in my txtbox this is the value: c:\..\mydocuments\sample.doc,,,after i locate the path then click the button show to be able to pop up the microsoft word or excel...how i'm gonna do that can you please help about this...
thanks
|
|
|
|
|
In solution select ad refercnce and select com
and select Microsoft office ...9.0
ADD this before calss declaration
Imports Office = Microsoft.Office.Core
try to make a class like this
...........
or u can use with out class directly
Public Class WordAppl
Private oWordAppl As Word.ApplicationClass
Public Sub New()
oWordAppl = New Word.ApplicationClass
strOfficeNote = "OFFICE NOTE"
' GetTagsFromDB()
iRpl = 0
iTagFound = 0
End Sub
' Open a file (the file must exists) and activate it
Public Sub Open(ByVal strFileName As String)
'//////////////////////////////////////
'/ Opens specified Document file /
'//////////////////////////////////////
Dim fileName As Object = strFileName
Dim readOnly1 As Object = False
'Dim isVisible As Object = True
Dim missing As Object = System.Reflection.Missing.Value
'isVisible
'oDoc = oWordAppl.Documents.Open(fileName, missing, readOnly1, missing, missing, missing, missing, missing, missing, missing, missing, isVisible)
oDoc = oWordAppl.Documents.Open(fileName, missing, readOnly1, missing, missing, missing, missing, missing, missing, missing, missing, True)
oDoc.Activate()
End Sub
Public Sub Open()
Dim missing As Object = System.Reflection.Missing.Value
oDoc = oWordAppl.Documents.Add(missing, missing, missing, missing)
oDoc.Activate()
End Sub
Public Sub Quit()
Dim missing As Object = System.Reflection.Missing.Value
oWordAppl.Application.Quit(missing, missing, missing)
End Sub
Public Sub Save()
oDoc.Save()
End Sub
Public Sub SaveAs(ByVal strFileName As String)
Dim missing As Object = System.Reflection.Missing.Value
Dim fileName As Object = strFileName
oDoc.SaveAs(fileName, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing)
End Sub
End Class
Just try it
GOOD LUCK
|
|
|
|
|
How can I kill one specific instance of a timer?
I have this application that works similar to msn messenger
a message is sent and a window display it in a viewlist and raise a warning window
there is 1 form with the listview and another with the warning window 'AlertWindow(messages)'
the one with the listview instantiate the warning form
Dim aFrmAlertPopUp As New AlertWindow(messages, altSysOrigin, alertId, BgColor, userAlias, altTeamMember, altAlertType)
aFrmAlertPopUp.display(messages)
the display method starts a timer
Friend Sub display(ByVal AlertMessage As String)
SyncLock GetType(AlertWindow)
Try
sender = "Bruno"
alertMessageArray = AlertMessage
Me.lblBody.Text = alertMessageArray 'anAlert.message
Me.lblSysOrigin.Text = sysOrigin
imgTopBar.Image = New Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("AlertClient.bar.bmp"))
' sideBar.Image = New Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("AlertClient.sidebar.bmp"))
startDisplay("A")
AddHandler AlertWindowTimer.Tick, AddressOf TimerEventProcessor
AlertWindowTimer.Interval = 10000
AlertWindowTimer.Start()
countWarnings = 1
Catch ex As Exception
utils.LogException(ex)
End Try
End SyncLock
End Sub
Private Sub TimerEventProcessor(ByVal myObject As Object, _
ByVal myEventArgs As EventArgs)
countWarnings = countWarnings + 1
Select Case countWarnings
Case 2
startDisplay("B")
Case 3
startDisplay("C")
AlertWindowTimer.Stop()
End Select
End Sub
would be possible to make this timer check if the message is still on the listview and stop if the message has been removed?
i have this messenger that shows a window 3 times with timespan breaks of 1 minute
so, what i want to do, is be able to kill one instance of the timer that controls it
lets say it receive a message on you msn messenger, then when the message arrives, it raise the window and start the timer that will show it again every minute for three times
lets say i send you 3 messages 'A' , 'B', 'C', but i want to stop only 'B'
if I simply shut the timer, all the three instances will die
how could i name a timer instance 'B' and shut only that?
I guess it could be solved usin dictionary in V2.o
Protected Shared tdict As New Dictionary(Of Integer, Timer)
but my app is framework 1.1
any ideas?
|
|
|
|
|
hellow ..
how i can use in cystal reports , in select expert the like statment with full options like in the sql statment %Name% ...
thxx
|
|
|
|
|
Isn't there already a "is like" option in the Select Expert?
|
|
|
|
|
Hi guys, I am writing data from dataset into an xml file. However, the xml file does not open correctly either in the browser or in excel. Is it because the size of the xml file is 25 mb (approx 50,000 records)? Is xml meant for handling huge data like this?
With Best Regards,
Mayur
|
|
|
|
|
You'd be better off parsing it with a SAX implimentation rather than the DOM. I believe XMLDataDocument is optimised for this sort of thing.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am a fresher in .net. I did not understand what you tried to explain in your reply. please explain it to me in simpler terms.
With Best Regards,
Mayur
|
|
|
|
|
SAX and DOM are the two ( standard ) ways to parse XML. I think if you use the XMLDataDocument class, you might be fine.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
mayhem_rules wrote: Is it because the size of the xml file is 25 mb (approx 50,000 records)? Is xml meant for handling huge data like this?
I'd really question why you want to store that amount of data in an XML file. Many people mistakenly confuse XML for some sort of database - which it is not.
Large amounts of data are better stored in a database.
Is this application sending data to another system which can only accept XML input?
...Steve
"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." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
-- modified at 17:14 Tuesday 28th February, 2006
|
|
|
|
|
No, I am not using the xml file as a database. Actually the issue is something else. I need to get the records in excel for the user. However, I do not know how to do that. I searched the internet and found information on writing to xml and opening the xml file in Excel. However, the xml file does not open in excel. Maybe the size of the xml file is the issue. I hope u have understood my problem. Please guide me with this. thnx.
With Best Regards,
Mayur
|
|
|
|
|
Ok, I see. Excel can diectly import CSV (comma separated value) files or TAB separated files. Maybe that would be a better way.
With XML, you have the overhead of a begin tag and an end tag wrapping each value which, depending on the tag names, can be rather long and a huge overhead per row of data. CSV (or TAB) delimited files on the other hand incur only a single character overhead between each value in each row of data which equates to a very much smaller file.
For example consider a Customer table defined in the database with the following (abstract) column names:
"CustomerName", "Address", "Country", "TelephoneNumber"
Assume some test data:
"steve", "111 nowhere street", "australia", "123456789"
"brian", "222 right rd", "usa", "123456789"
"tony", "333 left ave", "israel", "123456789"
"angela", "444 circular cres", "mars", "123456789"
"george", "555 main st", "moon", "123456789"
Note that the CSV file format is that shown above - quite compact.
If we extract this data to an XML file, it could end up looking something like this for each row (it is not accurate and is for explanation only):
<Customer>
<CustomerName>steve</CustomerName>
<Address>111 nowhere street</Address>
<Country>australia</Country>
<TelephoneNumber>123456789</TelephoneNumber>
...
</Customer>
Can you see the extra overhead in just one row of data? In this particular case the overhead exceeds the actual row data size. Multiple this by a factor of 50,000 (i.e. the rows in your database) and it is huge.
In short, yes XML is a good way of transporting data between dissimilar applications provided the number of data is relatively low and there is no other viable method.
...Steve
|
|
|
|
|
Steve, Thnx a lot for your reply. That clears much of my doubts. However, my main problem still remains. How do I export data to EXCEL or CSV or TSV. Please help.
With Best Regards,
Mayur
|
|
|
|
|
mayhem_rules wrote: How do I export data to EXCEL or CSV or TSV
Depends in which format the data is currently. From Microsoft SQL Server (Query Analyzer) you can run a query against the MSSQL database and export the results directly to CSV. Other database engine management tools also offer this feature. Also, I believe that Excel can hook into MS SQL Server directly - and possibly other databases with an ODBC connector. (You'll need to look that up in the Excel help.)
If the data is in a proprietary or other file format (i.e. non-database), you may need a simple program to extract the data and write a flat file (which is what a CSV really is anyway) into the format outlined in previous posts. This is easily done with VB (look up the file handling functions).
...Steve
"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." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once
|
|
|
|
|
I have this project which is a remote shutdown program in VB6. I don't know how to make it. I just want to ask your help guys regarding this. The program will shut down the specified PC on the network. Can anyone send me the code or as possible also send me the GUI of the program?
Thank you very much...
Chrysler Vergara
|
|
|
|
|
hi
the command that shuts down a pc is :
Shell "rundll.exe user.exe,exitwindows"
now you can find a way to start a program at the pc through network and put the previouse command in it
|
|
|
|
|
I've developed an application that connects to a web site, retrieves data and presents it to the user.
When I run it on a computer with XP1 it works fine but when i run it on a computer with XP2 it appears that it's completely blocked. I use an HTTP sniffer that shows that nothing issues an http request (The IE works fine and the sniffer shows it's traffic).
I tried shutting down the firewall and anything that might block HTTP traffic but nothing works.
Any ideas? may be it has nothing to do with XP2...
Thanks.
|
|
|
|
|
Hi guys
I am a student in learning Crystal Reports. I know the basic steps to generate it. but the problem is, according to my project, when I am going to generate the reports by passing the parameters indirectly such as login-company-name,UniqueID(which is globally assisted while at runtime), etc., here Indirectly means I don't want to enter that field directly, instead of this it will takes from globally assigned value that is login-company-name. so give the solution for this one.
wish me as All The BEST.
|
|
|
|
|
i using zedgraph to load the date and value from the database(access), to order to convert to double data type, i'm using ToOADate function but eventually my date has become a number such as 33200, can anyone tell me how to convert date to double so it can works n Zedgraph?
Below is the code i use...
Imports System
Imports System.Data
Imports System.Data.OleDb
Public Class Form2
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 zgc As ZedGraph.ZedGraphControl
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.zgc = New ZedGraph.ZedGraphControl
Me.SuspendLayout()
'
'zgc
'
Me.zgc.IsAutoScrollRange = False
Me.zgc.IsEnableHPan = True
Me.zgc.IsEnableHZoom = True
Me.zgc.IsEnableVPan = True
Me.zgc.IsEnableVZoom = True
Me.zgc.IsScrollY2 = False
Me.zgc.IsShowContextMenu = True
Me.zgc.IsShowCursorValues = False
Me.zgc.IsShowHScrollBar = False
Me.zgc.IsShowPointValues = False
Me.zgc.IsShowVScrollBar = False
Me.zgc.IsZoomOnMouseCenter = False
Me.zgc.Location = New System.Drawing.Point(72, 24)
Me.zgc.Name = "zgc"
Me.zgc.PanButtons = System.Windows.Forms.MouseButtons.Left
Me.zgc.PanButtons2 = System.Windows.Forms.MouseButtons.Middle
Me.zgc.PanModifierKeys2 = System.Windows.Forms.Keys.None
Me.zgc.PointDateFormat = "g"
Me.zgc.PointValueFormat = "G"
Me.zgc.ScrollMaxX = 0
Me.zgc.ScrollMaxY = 0
Me.zgc.ScrollMaxY2 = 0
Me.zgc.ScrollMinX = 0
Me.zgc.ScrollMinY = 0
Me.zgc.ScrollMinY2 = 0
Me.zgc.Size = New System.Drawing.Size(392, 208)
Me.zgc.TabIndex = 0
Me.zgc.ZoomButtons = System.Windows.Forms.MouseButtons.Left
Me.zgc.ZoomButtons2 = System.Windows.Forms.MouseButtons.None
Me.zgc.ZoomModifierKeys = System.Windows.Forms.Keys.None
Me.zgc.ZoomModifierKeys2 = System.Windows.Forms.Keys.None
Me.zgc.ZoomStepFraction = 0.1
'
'Form2
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(632, 266)
Me.Controls.Add(Me.zgc)
Me.Name = "Form2"
Me.Text = "Form2"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myConnection As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"DATA SOURCE=C:\Documents and Settings\Administrator\My Documents\Plantation.mdb;User Id='admin';Password='';")
Dim mySelectQuery As String = "SELECT Date,Last FROM Maxis"
Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)
myConnection.Open()
Dim myReader As OleDbDataReader
myReader = myCommand.ExecuteReader()
Dim junk As ZedGraph.ZedGraphControl
junk = zgc
junk.GraphPane.Title = "Test Case for VB"
junk.IsShowPointValues = True
Dim x(100) As Double
Dim y(100) As Double
Dim i As Integer
' Randomize()
For i = 1 To 100
myReader.Read()
MessageBox.Show((myReader.GetDateTime(0)).ToOADate)
x(i) = (myReader.GetDateTime(0)).ToOADate
y(i) = myReader.GetDouble(1)
Next
junk.GraphPane.AddCurve("Sine Wave", x, y, Color.Blue, ZedGraph.SymbolType.XCross)
junk.GraphPane.AxisFill = New ZedGraph.Fill(Color.White, Color.LightGoldenrodYellow)
junk.AxisChange()
' always call Close when done reading.
myReader.Close()
' Close the connection when done with it.
myConnection.Close()
End Sub
Private Sub zgc_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles zgc.Load
End Sub
End Class
sdasasd
|
|
|
|
|
hello guys,
I am working on a COM object in vb 6 that is posting a URL to possibly a Web service.
The result will be in the form of a xml format eg:
"
<providerpayresponse version="2">
"
"
<payments organisation="My Co" billpaycode="0123" channel="8" brander="7">
<payment commitpayment="1" paymentattemptid="123456789" paymentresponse="xx">
<ref value="34567">
<amt value="9874">
<paymentinstrument>
<unregpi>
<cardnumber value="1234567890987654">
|
|
|
|
|
The MSXML DOM implimentation uses COM, so you can use it from VB6.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Folks,
I am writing an Access database with a 2005 VB.Net front-end. I have 3 fields, "Arrived", "Departed" and "Duration" in the database bound to the form in .Net. I want to enter an arrival time in field number one, enter a departure time in field two, and have field three automagically calculated and populated with the total time spent on site (hours & minutes only). I have the first two fields down, no problem. But....I have scratched my head until it is RAW (:->) trying to get the third field to populate.
I have looked in the .Net books I have, I have searched online, and continue to come up empty with a solution!
Any help from the Guru's would be GREATLY appreciated.
-DON-
|
|
|
|
|
Just subtract Arrived from Departed. The result of that operation is a TimeSpan structure. Use one of it's properties to get the duration in the unit you want; TotalDays, TotalHours, TotalMinutes, TotalSeconds or TotalMilliseconds.
---
b { font-weight: normal; }
|
|
|
|
|
Hello there,
Don't give any suggestions or ask why i need to do this because i have spent too much time with it witout any success. I have a windows service running under system account, interacting with desktop. i need to launch a Gui application written in vb.net(or any Gui app) from my service(also written in vb.net). i am monitoring a program and need to restart when/if it dies. I can launch application and it does show up the gui, user can interact with it as well but only problem is that it runs under system account and i want to make it run under current logged in user(there is going to be only one user logged in to the system where this service is going to run, as we are providing a complete solution where we control all the attributes of system).
Qaiser.
|
|
|
|
|
Hello Alvaro,
We are migrating from VS 2003 to 2005 (VB.Net windows forms), We use the amstextbox in many places and it works great, but in 2005 when I bind the control to a data source, change the value and try to tab out or move out, it just does not exit the control. This happens only when bound, otherwise there is no problem, Have you or anyone else encountered this?
I would very much appreciate your reply.
Thanks a lot.
Canute.
|
|
|
|
|