First get the Office XP PIAs. Then you can use code like this:
Public Shared Function ReadFile(ByVal filename As String) As String
Dim app As ApplicationClass = Nothing
Dim objFilename As Object = CType(filename, Object)
Dim readOnly As Object = True
Dim isVisible As Object = False
Dim missing As Object = System.Reflection.Missing.Value
app = New ApplicationClass()
Dim doc as Document = app.Documents.Open(objFilename, missing, readOnly, missing,
missing, missing, missing, missing
missing, missing, missing, isVisible,
missing, missing, missing)
Dim text As String = doc.Content.Text
If Not(app Is Nothing)
app.Quit(missing, missing, missing)
Public Shared Function StripText(ByVal str As String) As String
Dim re as Regex = New Regex("[^a-zA-Z_0-9.?\-\(\)\\\/\:\;\""\'\,\s]")
str = re.Replace(str, "")
re = new Regex("\s+")
str = re.Replace(str, " ")
I'm a C# programmer so I'm a little rusty on VB. Anyways, you use doc.Content.Text to get the raw text from the document. There will be a lot of weird characters mixed in there, hence the regular expressions. There's probably a better regular expression, I just haven't had the time. What I've found is that this gives me just the text of the document and nothing else.
hi, please someone help me ,
I have a checkedlistbox loading data from a column in a table and when I chec a specific item it's price appear in textbox5.text as shown from the following code, my problem that the sum of the whole checked item didn't work ..
please someone run it to me , I need it today the life of my project depend on it.
Here is my code it works ,except the sum process.
visual basic code:--------------------------------------------------------------------------------<br />
Private Sub checkedListBox1_ItemCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs) HandlesCheckedListBox1.ItemCheck <br />
Dim sum As Double <br />
Dim c As Integer <br />
If e.NewValue.ToString() = "Checked" Then <br />
If TextBox4.Text.Trim() = "" And TextBox5.Text = ""Then TextBox4.Text = dt.Rows(e.Index)("PartName").ToString() ' TextBox5.Text = dt.Rows(e.Index)("Price").ToString() <br />
sum += (dt.Rows(e.Index)("Price").ToString()) <br />
Else TextBox4.Text += "," + dt.Rows(e.Index)("PartName").ToString End If <br />
TextBox5.Text = FormatCurrency(sum) 'the totla sum will represented in this txtbox <br />
End If <br />
Thaaaaaaaankx for who will give me a hand of help..
Hello Everyone, sorry to bother you, this can be a stupid request but I am really stuck up. I have a windows form (let's call it Form1) which needs to be able to catch an event from another form (let's call it Form2). Form2 is launched from within a method in Form1. Form2 has just two buttons that can be clicked by the user, and I need to catch those events from Form1.
Is it possible? and how can I do it without much trouble?
Thanks in advance and sorry for my bad english.
This code works in Visual Studio 2003. Form1 has a ListBox on it. Form2 has two command buttons named btn1frm2 and btn2frm2. Programatically create two command buttons on form1 and set them equal to the command buttons on form2. Now you can capture the events from the buttons on form2 in the event handlers for the buttons you programatically created on form1 as follows:
Private WithEvents b1f2 As Button<br />
Private WithEvents b2f2 As Button<br />
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
Dim form2 As New Form2<br />
b1f2 = form2.btn1frm2<br />
b2f2 = form2.btn2frm2<br />
AddHandler b1f2.Click, AddressOf b1f2_click<br />
AddHandler b2f2.Click, AddressOf b2f2_click<br />
End Sub<br />
Private Sub b1f2_click(ByVal sender As System.Object, ByVal e As System.EventArgs)<br />
End Sub<br />
Private Sub b2f2_click(ByVal sender As System.Object, ByVal e As System.EventArgs)<br />
End Sub<br />
VB.net / sql. Consider I have a table in sql with fields A to F each storing an integer value. I need to find the maximum value from the fields. Can anyone help me with this. Can this be done through a sql query? if yes, then how and if not then how to find the maximum value through program. plz help fast...
if you want to select the max value in the column A :
SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand("select max(A)from TableName", SqlConnection1)
Dim max As Integer = CType(SqlSelectCommand1.ExecuteScalar(), Integer)
thnx for your reply. However, I do not want to find the max value from a particular field. I need to find the maximum of the value from the fields A to F. say A has a value 1, B-2, C-3, D-4, E-5, F-3, then I need to find the value 5 using a query or a piece of code. Remember A, B, C, D, E & F are field names and not records.
Thnx Robert. Maybe I will try and explain it once again.
Consider a table having A - Z fields storing integer values. Therefore each record in this table will have A - Z fields. I need to find the maximum value for each record from the fields A - Z.
Can you plz help me with this.