|
Assuming you compiled to the DLL to msil and not all the way to native then Reflector works reasonably well - you will have to massage the code a lot to restore it to it's original state, but it is a lot faster than rewriting it ...
http://www.aisto.com/roeder/dotnet/[^]
|
|
|
|
|
I would like to know how to code a class library that will show the number of sentences in any document or file that is open. The number has to show in a label.
Thanks
|
|
|
|
|
los_coronado wrote: I would like to know how to code a class library that will show the number of sentences in any document or file that is open. The number has to show in a label.
This sounds like a homework/project/assignmnent question to me.
Where do you want to start? Do you have any idea how to approach this task? What you have asked for is rather vague and open-ended. What part are you particularly having trouble understanding? How to read the file, parsing the file's contents into sentences, creating the label (and where the label is to appear), is this a standalone program, part of a Word addin component, or what?
Be more specific with your questiosn and we can provide more useful help to you. We will not however, write the code for you. For that see www.rentacoder.com
...Steve
|
|
|
|
|
Sorry, this is the first time I post a question here.
Ok, here is what I need to do. I have a text box and labels to get the number of characters, words, sentences, paragraphas in it. I want to get the number of sentences, but I keep getting one when there is no "." in it.
Here is the code
Dim pstrStringString
Dim mintWords As Integer
Dim pstrSentences() As String = Split(pstrString, "." -1)
For s As Integer = 0 To pstrSenteces.Length - 1
mintWords +=1
I have to show the number of sentences in a label when a button is click. Why do I keep gettin one even tough there is no "."
|
|
|
|
|
los_coronado wrote: Why do I keep gettin one even tough there is no "."
I assume that you have typed in this code directly rather than copy/paste since there are a few syntax errors in it?
Anyway the problem is that Split(pstrString, ".", -1) will return ALL substrings of the input string regardless of the number of delimiters found. In other words Split("abc.def.ghi", "." , -1) will return an array of three substrings viz: "abc", "def", "ghi" whilst an input string of Split("this is a sentence without a period", ".", -1) will return an array of one element (look at the previous example too - there are only two periods in that string and it returned three).
Tip: when you observe unexpected behaviour like this, the first port of call should be to the online Visual Studio help. Just review the description of the function/method/property with which you seem to have trouble and it may explain why that behaviour occurs.
This is all part of the learning process, and thanks for posting a more comprehensive description of the problem since it helped me to help you.
...Steve
|
|
|
|
|
Thanks Steve.
I will follow your advice.
|
|
|
|
|
los_coronado wrote: I would like to know how to code a class library
Just type for a bit, then when it feels like you're done, stop.
los_coronado wrote: show the number of sentences in any document or file that is open.
OK, here's where you're really not telling us what you want.
1. Any document of what format ?
2. What does 'open' mean ?
3. How do you define a sentence, is it a line in a text file, or a full stop on the end of a word ? Or something else ?
Once you can define those things, then you can write some code. If you have *specific* questions about code you tried to write yourself, then ask here. Otherwise, as someone has said, try rentacoder, and accept that you will never be a programmer.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hello Forum Members,
I'm a newbie and I'm working on a small windows application that does an "activity" calculation. I would like to send the result of the calculation along with other information gathered (from text boxes) on the application to an excel file, with the ability to re-send new calculations done to the same excel file in the subsequent rows below (with the ability to add as many as I want). I have it working now where I have the headers, and the corresponding values below them going into an excel file. I'm trying to find information on how to get a new calculation into a new row below but I'm stumped. I took me forever to realize that I had to add an excel reference to my project to get the extraction to work. Not even sure if I'm going about this the right way. Any help would be greatly appreciated!!!
Here is the code for my "ExtractData" subroutine.
Private Sub ExtractData2()<br />
<br />
'Initialize Excel and create a new workbook/worksheet<br />
Dim excelApp As New Excel.Application<br />
Dim excelBook As Excel.Workbook = excelApp.Workbooks.Add<br />
Dim excelWorksheet As Excel.Worksheet = _<br />
CType(excelBook.Worksheets(1), Excel.Worksheet)<br />
'Makes Excel invisible to the user until spreadsheet is populated<br />
excelApp.Visible = False<br />
<br />
With excelWorksheet<br />
excelApp.Visible = True<br />
<br />
<br />
.Range("A1").Value = lblDate.Text ' these are labels that I am using from the designer view<br />
.Range("A1").Font.Bold = True<br />
.Range("A1").ColumnWidth = 10<br />
.Range("B1").Value = lblIDnumber2.Text<br />
.Range("B1").Font.Bold = True<br />
.Range("B1").ColumnWidth = 12<br />
.Range("C1").Value = lblFname2.Text<br />
.Range("C1").Font.Bold = True<br />
.Range("D1").Value = lblLname2.Text<br />
.Range("D1").Font.Bold = True<br />
.Range("D1").ColumnWidth = 15<br />
.Range("E1").Value = lblHeight2.Text<br />
.Range("E1").Font.Bold = True<br />
.Range("E1").ColumnWidth = 15<br />
.Range("F1").Value = lblWeight2.Text<br />
.Range("F1").Font.Bold = True<br />
.Range("F1").ColumnWidth = 15<br />
.Range("G1").Value = lblCounts2.Text<br />
.Range("G1").Font.Bold = True<br />
.Range("G1").ColumnWidth = 15<br />
.Range("H1").Value = lblCounttime2.Text<br />
.Range("H1").Font.Bold = True<br />
.Range("H1").ColumnWidth = 15<br />
.Range("I1").Value = lblIsotope2.Text<br />
.Range("I1").Font.Bold = True<br />
.Range("I1").ColumnWidth = 15<br />
.Range("J1").Value = lblEnergy2.Text<br />
.Range("J1").Font.Bold = True<br />
.Range("J1").ColumnWidth = 15<br />
.Range("K1").Value = lblRatio2.Text<br />
.Range("K1").Font.Bold = True<br />
.Range("K1").ColumnWidth = 15<br />
.Range("L1").Value = lblEfficiency2.Text<br />
.Range("L1").Font.Bold = True<br />
.Range("L1").ColumnWidth = 15<br />
.Range("M1").Value = lblActivity2.Text<br />
.Range("M1").Font.Bold = True<br />
.Range("M1").ColumnWidth = 15<br />
<br />
.Range("A2").Value = txtDate2.Text ' these are text boxes where the user enters values to do the calculation<br />
.Range("A2").Font.Bold = True<br />
.Range("A2").ColumnWidth = 10<br />
.Range("B2").Value = txtIDnumber2.Text<br />
.Range("B2").Font.Bold = True<br />
.Range("B2").ColumnWidth = 12<br />
.Range("C2").Value = txtFname2.Text<br />
.Range("C2").Font.Bold = True<br />
.Range("D2").Value = txtLname2.Text<br />
.Range("D2").Font.Bold = True<br />
.Range("D2").ColumnWidth = 15<br />
.Range("E2").Value = txtHeight2.Text<br />
.Range("E2").Font.Bold = True<br />
.Range("E2").ColumnWidth = 15<br />
.Range("F2").Value = txtWeight2.Text<br />
.Range("F2").Font.Bold = True<br />
.Range("F2").ColumnWidth = 15<br />
.Range("G2").Value = txtCounts2.Text<br />
.Range("G2").Font.Bold = True<br />
.Range("G2").ColumnWidth = 15<br />
.Range("H2").Value = txtCounttime2.Text<br />
.Range("H2").Font.Bold = True<br />
.Range("H2").ColumnWidth = 15<br />
.Range("I2").Value = txtIsotope2.Text<br />
.Range("I2").Font.Bold = True<br />
.Range("I2").ColumnWidth = 15<br />
.Range("J2").Value = txtEnergy2.Text<br />
.Range("J2").Font.Bold = True<br />
.Range("J2").ColumnWidth = 15<br />
.Range("K2").Value = txtRatio2.Text<br />
.Range("K2").Font.Bold = True<br />
.Range("K2").ColumnWidth = 15<br />
.Range("L2").Value = txtEfficiency2.Text<br />
.Range("L2").Font.Bold = True<br />
.Range("L2").ColumnWidth = 15<br />
.Range("M2").Value = txtActivity2.Text<br />
.Range("M2").Font.Bold = True<br />
.Range("M2").ColumnWidth = 15<br />
<br />
<br />
End With<br />
<br />
End Sub<br />
<br />
Private Sub btnSaveRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveRecord.Click<br />
ExtractData2()<br />
<br />
<br />
End Sub<br />
DCgamer
|
|
|
|
|
Take the variables excelApp, excelBook, and excelWorksheet outside of ExtractData2 method. To your form, add a button that creates the three variables mentioned above and initializes the subtitles.
Now that you have a reference to the excelWorksheet, you should be able to append data from your form to any row as long as you keep track of the last row number added.
To close the application:
<br />
excelBook.Close()<br />
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelBook)<br />
excelBook = Nothing<br />
excelApp.Quit()<br />
System.Runtime.InteropServices.Marshal.ReleaseComObject(excelApp)<br />
excelApp = Nothing<br />
|
|
|
|
|
Help ! I'm struggling to get consistent repeatable use of the following code
http://support.microsoft.com/?kbid=311284. I'm basically have an AXWebBrowser control on an MDI form. The page loads a html file with images. The images have an ID tag that I then capture as being clicked and process some action e.g. show another mdi form. Unfortunately it works once but then fails any subsequent clicks. Equally the mouse over event works for a period of time (see Microsoft example) - then stops ! Randomly. The event capturing just does not fire. Anyone out there have example code ? I just cant get reliable event firing from the Microsoft example.
|
|
|
|
|
i am working on an application which is a door terminal application, now i want to implement a function which is when there is no one touch the application there is a screensaver application(which i also did it ) come up. how to implement this, especially how to detect no one touched the application within certain time!
I am Entry level person
|
|
|
|
|
Set a timer to start your screensaver. reset it every time your app recieves a keyboard or mouse event.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
this is an example of out I set a textbox:
Private Function InputBoxValue(ByVal controlname As String, ByVal value As String)
Dim tmpIBox As mshtml.IHTMLInputTextElement = doc.getElementsByName(controlname).item(, 0) 'get first name inputbox
tmpIBox.value = value
End Function
But I can't for the life of me figure out how to set a radio value... example:
<INPUT NAME='DL_trial_timeAmPm' TYPE=radio VALUE='AM' >AM<INPUT NAME='DL_trial_timeAmPm' TYPE=radio VALUE='PM' >PM<P>
Thanks in advance.
|
|
|
|
|
kjhkjhkjhkjhkjhkjhkjhkjh wrote: But I can't for the life of me figure out how to set a radio value... example:
For the life of me I can't figure out what you are talking about. If you want help, help us and yourself by explaining your programming problem better and in more detail.
...Steve
|
|
|
|
|
I need to set a radio value on a webpage....... I programmatically login into the website using the axwebbrowser control. Then from there on I use getElementsByName Method on the document to get the fields value or set it. I can get the method to work for every other field type except radio option which is an input field. If you've never worked with html and this object you'll of course have no idea what I'm talking about. Again thanks in advance if you have any help in this matter.
example that I'm trying to perform:
Private Function InputRadioValue(ByVal controlname As String, ByVal value As String)
Dim tmpIBox As mshtml.IHTMLOptionButtonElement = doc.getElementsByName(controlname).item(, 0) tmpIBox.checked = True
End Function
I've changed the index on the item but it doesnt seem to point to the right value
|
|
|
|
|
nice username. is that your real name?
I wish my username was that cool.
Pumk1nh3ad illustrates that Intelligent Design oft goes awry. - Ed Gadziemski
|
|
|
|
|
Try this...
Dim tmpIBox As mshtml.IHTMLInputTextElement = doc.all.item(controlname, 0)
...Steve
|
|
|
|
|
I receieved the following error when I used the code on the previous thread. "QueryInterface for interface mshtml.IHTMLInputTextElement failed" Now the code that I used before was:
Dim tmpIBox As mshtml.IHTMLOptionButtonElement = doc.getElementsByName(controlname).item(, 0) 'get first name inputbox
tmpIBox.checked = True
now this code worked for the first option value but there are two with the same name like so:
AMPM
so basically I need to get the second option now when i try to change the index.. it doesn't work. any suggestions?
|
|
|
|
|
found out the problem .......the example they had doc.getElementsByName(controlname).item(, 0) was wrong..... there is not supposed be a comma in the index!!! lol :->
|
|
|
|
|
Ahhh...I always like the simple solutions! Glad you found it. Thanks for posting your resolution as it helps others in the same situation. BTW, I like your new name.
...Steve
|
|
|
|
|
Hi All,
I want to Import Data From Oracle DUMP File *.DMP into SQL Server.
how can i import data from Oracle Exported *.DMP to SQL sever ,
Thanks in Advance.
Muhammad Nadeem.
|
|
|
|
|
Hi all
I have the following piece of code where I am checking for the status of the printer. But I am not able to figure out why even while the printer is priting Printer.PrinterStatus returns 2 which corresponds to Unknown printer status
Please let me know if the code is wrong and is there any other way to check for the status of the printer.
Code is
Private Sub btnPrinter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrinter.Click
Dim PrinterSet As Object
Dim Printer As Object
Dim DefaultPrinter As Object
PrinterSet = GetObject("winmgmts://localhost")
DefaultPrinter = PrinterSet.ExecQuery("Select * from Win32_Printer Where Default = True")
For Each Printer In DefaultPrinter
MsgBox(Printer.Name & ": " & Printer.PrinterStatus)
Next Printer
End Sub
Thanks and Regards
VanitaJ
-- modified at 19:34 Monday 7th November, 2005
|
|
|
|
|
I put the code under timer event of very small duration and it worked fine.
But I dont get any other states than IDLE,UNKNOWN,PRINTING.
How to retrieve the printer state like warmingup,paper jam,toner low etc
If anyone has idea about it please let me know
Thanks and Regards
VanitaJ
|
|
|
|
|
You can't get that information because it's not exposed to the WMI methods your using. You can only the same information you see if you open the Printers folder to see the details of all the printers installed on the system.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So can I get the required information if I use System.Management.ManagementObject class ?
~VanitaJ
|
|
|
|