|
alexfromto wrote: You've mentioned that it would be Office Add-In. Is it possible to write something like this in VB.NET using VS. Currently we have VS v. 2003? And if it is, how do I integrate it into Exchange?
This would be a client-side Outlook Add-In, not an Exchange app. Start here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave. Client-side Add-In. Does this mean I have to install my add-in on each machine?
Or is it possible somehow avoid that? In Lotus Notes all users have their own database but the design template is one for everybody. So when we created this little application we only had to update main database to inlcude button (which brings folders list).
Thanks,
|
|
|
|
|
alexfromto wrote: Does this mean I have to install my add-in on each machine?
Yep.
alexfromto wrote: Or is it possible somehow avoid that?
Nope.
alexfromto wrote: In Lotus Notes all users have their own database but the design template is one for everybody. So when we created this little application we only had to update main database to inlcude button (which brings folders list).
As you've probably already noticed, you're not asking about Notes...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi All,
I have an unusal problem with my forms.
I press a button2 to display a form2 (which displays as topmost)
Then ill press button3 to close form2 and display form3 (form3 also display as top most) and this works fine.
However...if say i have form2 open and i press button4 to display form4, then close form4, and then press button3 (which closes form2 and siplays form3) what happens here instead is that form3 displays BUT form2 does not close.
this is the sort of code im using
f.Close()
f = New Form2
f.Show()
Was hoping somebody maybe able to help me with this problem.
Thanks in advance.
Jaidev
|
|
|
|
|
Without seeing the code for all the button click event handlers, it's impossible to tell you what's wrong from the little snippet you've provided.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
My guess is that based on the little code you posted you are using 'f' to represent the open form. So you press button2 and 'f' gets set to form2 which is then shown. When you press button3, you call f.close which closes form2 then you set 'f' to equal form3. However, the problem is that when you open form4 which you probably set 'f' equal to, you don't close form2. Now 'f' references form4 not form2. So when you click button3 and call f.close it try's to close form4 which is actually already closed.
|
|
|
|
|
Hello,
I am getting following error when hit the update button.
No error message available, result code: DB_E_ERRORSOCCURRED(0x80040E21).
Any idea Why? thanks.
here is my code:
Private Sub btnupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnupdate.Click
Dim data As New DataSet
Dim dbConn As OleDb.OleDbConnection
Dim dataAdapter As OleDb.OleDbDataAdapter
Dim connectionString As String = "Provider=sqloledb;Data Source=A45292\SQLEXPRESS;Initial Catalog=FSS;Integrated Security=True"
Dim sqlString As String = "SELECT * FROM [Caller Records] Where RecordNo =" & TextBox2.Text
dbConn = New OleDb.OleDbConnection(connectionString)
dataAdapter= New OleDb.OleDbDataAdapter(sqlString, dbConn)
dataAdapter.Fill(data, "Caller Records")
Dim tbl As DataTable
tbl = data.Tables("Caller Records")
Dim selectedRows() As DataRow
selectedRows = tbl.Select("RecordNo = " & TextBox2.Text)
If selectedRows.Length > 0 Then
selectedRows(0).Item("FirstName") = FirstNameTextBox.Text
selectedRows(0).Item("LastName") = LastNameTextBox.Text
End If
dataAdapter.Update(data, "Caller Records")
dbConn.Close()
programmer
|
|
|
|
|
First, why are you using the Ole data providers when your using a MS SQL Server? Use the Sql Server providers (SqlConnection, SqlCommand, Sql...) for better performance.
Next, you're retrieving all this data just to find a record and write it back when you don't have to. The DataSet object that you filled with your DataAdapter already has this data in it. If the textbox's are bound to the DataSet, the updates have already been made. Just call the Update method on your DataAdapter and it'll write the changed records back to the database. Just about all of this code is unnecessary.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
because textboxes are not bound.
programmer
|
|
|
|
|
Hi there
I'm looking for a reasonable way to avoid the serialization of events/eventhandlers in VB.NET (2005).
Since the structure of the objects I wanna serialize is quiet comlex, removing before and re-adding all handlers after the serialization could generate new problems.
Is there any solution except moving to C# or implementing ISerializable?
Thanks!
|
|
|
|
|
have you tried <xmlignore>
ex
<serializable> _
class xxxxx
<xmlingore> public sName as string 'will not be serialized
public sAddress as string
end class
|
|
|
|
|
What you suggested is what I usually end up doing, including adding custom serializer code to add support for handling Color and Font objects. Talk about Tedious Infinitum.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
|
Well, you don't have much of a choice. See here[^] for a great summary of your options.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks guys for the replay!
Since I have some COM stuff included I'm afraid to be forced to use the binary formatter. So <xmlignore> will probably not work.
What I further need is an abstract soution since the project I'm working on is a kind of a framework. Using any 'object specific' implementation could end up in a mess.
I have had seen the link Dave mentioned before I posted this message and I was hoping that there might be an easier way.
It's really a shame.
Rudi
|
|
|
|
|
Hello,
I am trying to convert a string representation(2007-02-22) into a dateformat yyyyMMdd. it returns the right result as string but I want the returned type as date and in this format 2007-02-22 as XML API I am using requires a DATE not STRING representation like this.
Am I missing something very easy here (quite possible)?
Appreciate any replies.
|
|
|
|
|
Did I get it right that you have a string representation of a date and want to convert this into a DateTime instance.? If so, then take a look at the DateTime.TryParseExact or DateTime.ParseExact (framework < 2.0) methods. Both methods let you specify a custom format for the input string.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thnks Stefan the issues has been resolved.
Cheers!
|
|
|
|
|
How do I check fields in a database table for specific characters (for example, checking to see if the first two characters in the field are "\\"), using an if statement in a stored procedure.
Thanks,
Rhonridge
|
|
|
|
|
|
Im unsure where I should place the code for closing, flushing, and disposing of the various readers and writers.
Currently I place the .Flush and .Close inside the try block right before the Catches and then I place the .Dispose calls inside the Finally .
Cleako
|
|
|
|
|
Normally, you'd place the .Flush/.Close and .Dispose in the Finally block. You'd first check to see that the stream is indeed open before you called Close on it, then Dispose it.
Why? Because your code could throw an exception before or during the file open, so it's possible that the file never gets opened. Also, it's possible that your code could throw an exception during the manipulation of the file, leaving the file hung open in the Catch/Finally handlers. Finally gets executed no matter what happens in the Try block, so checking and closing the file in the Finally block is the best place to do it.
Dim sw As StreamWriter
Try
sw = New StreamWriter(filePath)
For x As Integer = 1 to 100
sw.WriteLine(x)
Next
Catch ex As Exception
' used a 'catch all' Exception which is not really good practice!!
Finally
' You'll only get a StreamWriter object if the file was successfully opened!
If Not sw Is Nothing Then
sw.Close()
sw.Dispose()
End If
End Try
Now in place of that, with VB.NET 2005, you can instead use the Using keyword to do the same thing. When the code execution leaves the Using block for any reason the object created on the Using line is automatically closed Disposed.
Try
Using sw As StreamWriter = New StreamWriter(filePath)
For x As Integer = 1 to 100
sw.WriteLine(x)
Next
End Using
Catch ex As Exception
...
End Try
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Does that take care of the flush and everything? If I have multiple writers would it make a difference to have all of those nested?
Cleako
|
|
|
|
|
cleako wrote: Does that take care of the flush and everything?
Disposing a StreamWriter, or any file stream for that matter, automatically calls Flush and Close.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
If I have, say 5 writers, to write to 5 files depending on a condition, if I use the keyword Using and I create all 5 is there a way to avoid that indenting?
Cleako
|
|
|
|