|
I need some guidance regarding a Windows Service Application and MS-Outlook 2000 type library (msoutl9.olb)
My service app needs to scan an outlook inbox at regular intervals and process incoming email messages. My problem is that the application is unable to create the instance of the Outlook.ApplicationClass() object.
The app has the proper installers and has been installed to run on the local machind under the LocalSystem account.
The Outlook application and namespaces are declared at the beginning of the class definition:
Protected Friend olApp As Outlook.ApplicationClass<br />
Protected Friend olNS As Outlook.NameSpace
I attempt to start the Outlook instance in my service's OnStart() event:
Protected Overrides Sub OnStart(ByVal args() As String)<br />
<br />
'write entry that service has started<br />
EventLog1.WriteEntry("KeyMailSvc Started")<br />
<br />
Try<br />
<br />
'start outlook app and open namespace<br />
olApp = New Outlook.ApplicationClass()<br />
olNS = olApp.GetNamespace("MAPI")<br />
olNS.Logon("", "", False, True)<br />
<br />
'start the timer<br />
With Me.Timer1<br />
.Interval = 30000<br />
.Enabled = True<br />
End With<br />
<br />
<br />
Catch ex As System.Exception... (some error logging goes here)<br />
<br />
I do not get to the Catch. Attempts to start the service time out and I get a MS error message "The server {0006F03A-0000-0000-C000-000000000046} did not register with DCOM within the required timeout." in my System log.
If I compile the same code as a WinForms app and move the Outlook code to the Form_Load event, I have no problems. Can anyone shed some light on this for me?
|
|
|
|
|
Just a quick note...
When I change the object type from Outlook.ApplicationClass object to Excel.ApplicationClass object, the service starts.
Protected Overrides Sub OnStart(ByVal args() As String)<br />
<br />
'write entry that service has started<br />
EventLog1.WriteEntry("KeyMailSvc Started")<br />
<br />
Try<br />
<br />
'start outlook app and open namespace<br />
Me.olApp = New Excel.ApplicationClass()<br />
'Me.olNS = olApp.GetNamespace("MAPI")<br />
'Me.olNS.Logon("", "", False, True)<br />
|
|
|
|
|
I have a VB6 application that I am upgrading to VB .NET
I am having difficulty with pupup menus, (right click an item and pop a menu based on current system status) any samples or examples of how this can be done would be appreciated.
|
|
|
|
|
Are you referring to context menus?
If so, simply drag a context menu from the toolbox into your designer window. When highlighted, it will appear as a menu at the top of your form where you can customize it and add menu items.
Assigning it to controls is easy. Simply select a control on your form, and change the Context Menu property to your newly created context object.
Hope this is what you mean?!
|
|
|
|
|
Hrmph... Kinda guess I got thrown off looking for a tricky way to do it. Thanks for your help, just what I was looking for...
|
|
|
|
|
Ok, so I have created my ActiveX control (using VB6) and now have an .OCX file (with others from the compilation).
I know that when I register this .OCX file from inside my target application (MS Access), I can use the control I created.
How can I distribute this when I update my Access "application" on other PCs?
Do I need to do anything, OR is distributing my latest .MDB file (which includes my inclusion of my ActiveX control) good enough? The later I can try.
Reason: I want to eliminate the user's need to go through Tools | ActiveX Controls | Register | (browse for my .OCX file).
Thanks,
Johnny
|
|
|
|
|
I have a couple of different procedures that retrieve data from a single database. Both return a single value, either an Integer or DateTime. But the one that returns an integer accesses the data by connecting to the database and returning the data using .ExecuteScalar, while the other one builds a DataAdapter, a DataSet, and a DataTable, then references the DataTable to get the data.
my question is, is there any advantge to using DataSets over directly query-ing the database?
|
|
|
|
|
The difference here is not the dataset or not, it is the data adapter or the execute scalar method. Executescalar returns a single value and will always return a single value. The other query, if it always returns a single value would possibly benefit from using the executescalar method b/c it wont use all that memory overhead with datasets and adapters and such.
If you will need to return more than a single value then you have 2 choices really, the dataadapter allows you grab a dataset or fill a datatable - or you can use a datareader. Both return a set of data and have their benefits and problems.
So after a long windy explaination - you are querying the database no matter what, but one uses more objects to get the data.
Cleako
|
|
|
|
|
I have a DataAdapter that joins 3 tables together. The DataAdapter fills a DataSet from these tables. How can I add a new row to the DataSet? I'm using the code below to do this but it errors out on the last line.
Dim newrow As DataRow
newrow = MyDataSet.Tables("MyDataTable").NewRow()
newrow.Item("column1") = 0
newrow.Item("column2") = 1
newrow.Item("column3") = 1
MyDataSet.Tables("MyDataTable").Rows.Add(newrow)
Thanks again in advance.
|
|
|
|
|
I cant see an obvious problem with this code, its very similar to something I use currently.
What exactly is the error?
|
|
|
|
|
Error message is:
"Object reference not set to an instance of an object."
Is the problem because I have more then one table in the DataAdapter? Adding a record to the DataSet is Ok, but the DataSet maps back to three tables. How does it know which of the three tables should end up with the new row?
|
|
|
|
|
1. How do I dynamically generate a datagrid and trap the keyboard keys or mouse click in a datagrid cell?
2. How do I prevent from user to add more rows to datagrid?
3. How do I add the footer totals and change them according to the datagrid cell values?
Simpra
|
|
|
|
|
hi guys!
I'm working on a project now, i need to shut down windows XP via vb6 code.
Can somebody please help me about this subject?
|
|
|
|
|
Run the remote windows shutdown application using the "shell" command. The path for the application is:
C:\WINDOWS\system32\shutdown.exe
°[Halo]°
Project Basilisk
|
|
|
|
|
You can shutdown, and optionally restrat, the system by calling the Win32 API function ExitWindowsEx[^]
Declare Function ExitWindows Lib "user32" Alias "ExitWindowsEx" ( _
ByVal dwReserved As Long, ByVal uReturnCode As Long) As Long
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a vb.net project with a few web pages, in each of the pages they call a custom control type which has scroll bar built in, thats fine and when the pages call each other i can controll the call to the other page by adding scrollbars=no in the window.open call, but when i set one of the pages to set as start page how do i them control if a scroll bar appears?????
any ideas?
Thanks
|
|
|
|
|
Can't you set the .scrollbars = no in the form "Load" event?
Thanks,
Taen Karth
|
|
|
|
|
I have a vb.net project with a few web pages, in each of the pages they call a custom control type which has scroll bar built in, thats fine and when the pages call each other i can controll the call to the other page by adding scrollbars=no in the window.open call, but when i set one of the pages to set as start page how do i them control if a scroll bar appears?????
any ideas?
Thanks
|
|
|
|
|
Assignment #3
Q1. Which of the following is a valid condition for an IF …THEN…ELSE statement?
a. Val(txtage.text > 65)
b. Val(lblprice.text) > 0 AND < 10
c. curSales > 500 AND < 800
d. curCost > 100 AND curCost <= 100
e. UCase(strstate) = “Alaska” and UCase(strstate) = “Hawaii”
Q2. Evaluate the following expression: 3 > 6 AND 7 < 4
a. true
b. false
Q3. Evaluate the following expression: 7 >= 3 + 4 OR 6 < 4 AND 2 < 5
a. true
b. false
Use the following information to answer questions Q4 to Q8
X = 5, Y = 3, Z = 2, A = True, B = False
Q4. Evaluate the following expression: X * Z > X * Y AND A
a. true
b. false
Q5. Evaluate the following expression: X * Y > Y ^ Z
a. true
b. false
Q6. Evaluate the following expression: X * Y > Y ^ Z AND A OR B
a. true
b. false
Q7. Evaluate the following expression: A OR B
a. true
b. false
Q8. If the testexpression used in the SELECT CASE clause is the numeric variable curSales, which two of the following CASE clause is valid?
a. CASE 2, 4, 6, 8
b. CASE “1” TO “3”
c. CASE IS < “6”
d. CASE IS >= 8
e. CASE 4.5 Through 8.5
Q9. Assume the form contains two grouping objects(i.e controls). Each group object contains three options buttons. How many option buttons can be on at any time?
a. one
b. two
c. three
d. four
e. six
Q10. Assume the form contains two grouping objects (i.e controls). Each group object contains two check boxes. How many check boxes can be on at any time?
a. one
b. two
c. three
d. four
e. six
Q11. You can use the ____________ statement to invoke a user defined sub procedure.
a. CALL
b. DoProcedure
c. GET
d. INVOKE
e. ProcedureCall
Q12. The MsgBox function displays a dialog box that contains ____________
a. a message
b. one or more command buttons
c. an optional icon
d. all of the above
Q13. Assume IntCount is a numeric variable, what is the value of the IntCount when the loop stops?
FOR IntCount = 1 to 6
Lbldisplay.text = IntCount
Next IntCount
a. 1
b. 5
c. 6
d. 7
e. 8
Q14. Programmers call the ____________ loop a posttest loop because the condition is tested at the end of the loop.
a. DO… UNTIL
b. DO… WHILE
c. FOR…NEXT
d. a and c
e. b and c
Q15. Items appearing within the parentheses after an event procedure’s name are called ____________.
a. arguments
b. controls
c. indexes
d. properties
e. values
Q16. The ____________ statement turns the error trapping process on
a. Error
b. On Error GoTo
c. On Error Process
d. Process Error
e. Trap Error
Q17. Which of the following descriptions and filters tells Windows to display only project filenames – those ending in either .vbp, .mak, or .vbg?
a. “Project Files(*.vbp;*.mak;*.vbg)| *.vbp|*.mak|*.vbg”
b. “Project Files(*.vbp;*.mak;*.vbg)| *.vbp;*.mak;*.vbg”
c. “Project Files(*.vbp|*.mak|*.vbg)| *.vbp;*.mak;*.vbg”
d. “Project Files|*.vbp;*.mak;*.vbg)| *.vbp;*.mak;*.vbg”
Q18. If you invoke the UpdateAge procedure, passing it a string variable named strFriend and an integer variable named intAge, which of the following is a correct Private Sub statement for the UpdateAge procedure?
a. Private Sub UpdateAge( )
b. Private Sub UpdateAge(intAge as integer, strFriend as string)
c. Private Sub UpdateAge intAge as integer, strFriend as string
d. Private Sub (UpdateAge) intAge as integer, strFriend as string
yo
|
|
|
|
|
krugerkelly wrote:
Assignment #3
You're an idiot. You snooze while we do your homework for you? Who do you think you are?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is this becoming a big problem? I got into it with a poster on another site for something similar. They wanted someone to code their project for them and they offered to pay. The only outcome here is that this person will graduate and not know anything and get a job by lying then be someone's inept co-worker.
Cleako
|
|
|
|
|
I have an app i am working on that reads a .csv file to validate it.
here is the connection styring i am using to upload it:
Dim conn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & pather & ";Extended Properties=""text; HDR=No; FMT=Delimited; IMEX=1\"""
The problem i am having is that i do NOT want the first row to be counted as a header, I even have it specified in the string, but without fail, it always loads the first row as one.
It is driving me nuts, am i missing something?
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
Well, using your code and my test file, I don't have that problem. But, you might want to clean up your connection string a little bit the part with the IMEX value is malformed.
Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\;" & _
"Extended Properties=""text;HDR=No;FMT=Delimited;IMEX=1"";"
Dim conn As New OleDbCommection(connString)
Dim comm As New OleDbCommand("Select * From TestData.csv", conn)
conn.Open()
Dim dr As OleDbDataReader = comm.ExecuteReader()
If dr.HasRows Then
Do While dr.Read()
Debug.WriteLine(String.Format("{0} - {1}", dr.GetValue(0).ToString(), dr.GetValue(1).ToString())
Loop
End If
conn.Close()
Are you doing something in your reading that is skipping the first row?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Not that i am aware of. here is how i am using it:
<br />
Private Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpload.Click<br />
<br />
Dim conn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _<br />
Session("pather") & _<br />
";Extended Properties=""text;HDR=No;FMT=Delimited;IMEX=1"";"<br />
<br />
<br />
If f = ".csv" Then<br />
xl = "SELECT * FROM " & filer<br />
Fill(xl, conn)<br />
End If<br />
End Sub<br />
<br />
Private Sub Fill(ByVal xl As String, ByVal con As String)<br />
<br />
Dim com As New OleDbDataAdapter(xl, con)<br />
Dim ds As New DataSet<br />
<br />
com.Fill(ds)<br />
com.Dispose() <br />
<br />
Me.DataGrid2.DataSource = ds<br />
Me.DataGrid2.DataBind()<br />
End Sub<br />
<br />
all i am doing at this point is grabbing the data in the .csv file and populating a dataset with it. No matter what i do, however, it keeps using that first row as a header, even with the cleaner connection string.
______________________
Mr Griffin, eleventy billion is not a number...
|
|
|
|
|
I tried it with this and found no problems:
Dim connString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\;" & _
"Extended Properties=""text;HDR=No;FMT=Delimited;IMEX=1"";"
Dim conn As New OleDbCommection(connString)
Dim da As New OleDbDataAdapter("Select * From TestData.csv", conn)
Dim ds As New DataSet
da.Fill(ds)
conn.Close()
conn.Dispose()
DataGridView1.DataSource = ds.Tables(0)
The DataGridView control replaces the DataGrid in 2002/2003. Since it can only display a single table at a time, you must specify which table in the dataset to bind to.
What's in the first 10 rows of this .CSV file? Could the data in the file be misinterpreted by the ISAM driver?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|