|
i'm reading the files names from a directory and subdirectory, and i want to bound a progress bar with the time of getting the files from the directory, how?
Faris Madi
Nothing Comes Easy (N.C.E.)
|
|
|
|
|
How can i handle something when the the system is idle
for example the screen saver run with the system is idle
Faris Madi
Nothing Comes Easy (N.C.E.)
|
|
|
|
|
i want to read a text from word document, how can i read the content without reading the scripts and styles of the word.
Faris Madi
Nothing Comes Easy (N.C.E.)
|
|
|
|
|
First get the Office XP PIAs. Then you can use code like this:
Imports System.Text.RegularExpressions
Imports Microsoft.Office.Interop.Word
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
Try
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)
doc.Activate()
Dim text As String = doc.Content.Text
Return StripText(text)
Catch
Throw
Finally
If Not(app Is Nothing)
app.Quit(missing, missing, missing)
End If
End Try
End Function
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, " ")
Return str
End Function
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 everybody
am working on mshflexgrid, i need to know how can i set an icon in the row header to indicate that the row is the current one, and how to remove it when moving to another row.
thanks alot
Byeeeeeeeee
|
|
|
|
|
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 />
End Sub
Thaaaaaaaankx for who will give me a hand of help..
|
|
|
|
|
sum += (dt.Rows(e.Index)("Price").ToString())
if i correctly read your code, here you're putting in a DOUBLE something that's a STRING... you should parse it to a Double before adding the values!
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
hi
when we press alt+shift inside textboxes, we convert to the second
keyboard language . what i want is to do this programmatically
i.e directly start writing in the second language
Tamimi - Code
|
|
|
|
|
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.
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
The 'dirty' method would be to make the two buttons (the fields) public. Then Form1 could bind the event directly:
Form2 f = new Form2();
f.button1.Click += ...;
f.button2.Click += ...;
Better would be to make public event in Form2 and letting Form1 catch those instead:
public event EventHandler Button1Clicked;
public event EventHandler Button2Clicked;
private void button1_Click(object sender, EventArgs e) {
if (Button1Clicked != null)
Button1Clicked(this, EventArgs.Empty);
}
Form2 f = new Form2();
f.Button1Clicked += ...;
f.Button2Clicked += ...;
|
|
|
|
|
sorry to bother you again, but even if it works in C# i can't get it working in VB.NET. Any ideas if there's some other way to do this (and in VB)?
Thanks again
~~~ From Milano to The Hague, easy as it goes ~~~
|
|
|
|
|
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 />
<br />
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load<br />
<br />
Dim form2 As New Form2<br />
<br />
b1f2 = form2.btn1frm2<br />
b2f2 = form2.btn2frm2<br />
AddHandler b1f2.Click, AddressOf b1f2_click<br />
AddHandler b2f2.Click, AddressOf b2f2_click<br />
<br />
form2.Show()<br />
<br />
End Sub<br />
<br />
Private Sub b1f2_click(ByVal sender As System.Object, ByVal e As System.EventArgs)<br />
ListBox1.Items.Add("1")<br />
End Sub<br />
<br />
Private Sub b2f2_click(ByVal sender As System.Object, ByVal e As System.EventArgs)<br />
ListBox1.Items.Add("2")<br />
End Sub<br />
|
|
|
|
|
Am using VB.NET 2005 with WebBrowser Control, when i run it then i typed the url and then it display correctly, when the javascript is alert the title is Microsoft Internet Explorer, how can i chnage it?
................
|
|
|
|
|
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...
With Best Regards,
Mayur
|
|
|
|
|
hi
if you want to select the max value in the column A :
SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand("select max(A)from TableName", SqlConnection1)
SqlConnection1.Open()
Dim max As Integer = CType(SqlSelectCommand1.ExecuteScalar(), Integer)
SqlConnection1.Close()
Tamimi - Code
|
|
|
|
|
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.
With Best Regards,
Mayur
|
|
|
|
|
Well then execute the query 6 times or just make one select to get the maximum of all fields together and then use Math.Max to determine the biggest ones among these.
|
|
|
|
|
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.
With Best Regards,
Mayur
|
|
|
|
|
There is no simple way of doing that, as the database is badly designed.
For the fields A to C, it would be
select case when A > B then (case when A > C then A else C end) else (case when B > C then B else C end) end from ...
Imagine what that would look like for A to Z... The query would most likely be too complex to even run...
The values should be stored in separate records (in a separate table) if you want to be able to aggregate them efficiently.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks Guffa. I understand what you mean to say. Can you suggest a way this can be done using vb.net. As in reading a record and then finding the maximum value through code...
With Best Regards,
Mayur
|
|
|
|
|
You have badly designed the database, and there is no easy way to aggregate this data.
Maybe you could explain what you are trying to achieve, and somebody could make some suggestions on how to go about it better.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Hi, how can i get the motherboard's unique ID using VB? I have seen recently an article on Code Project describing how to do this using web and .net but i need to do the same in vb.
Rod
|
|
|
|
|
Hello everybody. Below codes didn't run but they could run on visual studio 6.0.
I am using .net 2003. Is there any idea? thanks.
Dim xapp As Excel.Application
Dim wb As Excel.Workbook
Dim ws As Excel.Worksheet
xapp.Visible = True
xapp = new Excel.Application
wb = xapp.Workbooks.Open("d:\sample.xls")
ws = wb.ActiveSheet
...
|
|
|
|
|
try this :
Dim var_AppClass As New ApplicationClass
Dim var_wookbook As WorkbookClass
Dim path As String = "c:\Book1.xls"
var_wookbook = var_AppClass.Workbooks.Open(path, 1, True, 5, "", "", True, Excel.XlPlatform.xlWindows, "\t", True, False, 0, True, 1, 0)
Dim var_sheets = var_wookbook.Sheets
...
Tamimi - Code
|
|
|
|
|
I want to develop an application in VB.Net which monitors the access to PC. So when PC boots my Application must pop disabling all options like Task bar, right click, all special keyboard function (Like Ctrl+Alt+Del). Can anybody suggest how to achieve this in VB.Net
Regards,
Krishnaraj
|
|
|
|