|
What this code does is let me choose a file, like an article saved in a .rtf file and take the text from that and put it into a .html file. The problem I'm having is in the middle, in the part that writes "the BULK of the content to the new file". It stops writing the writing the content from the .rtf file to the new file after it has written so many characters.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button1.Click
Dim openStream As New FileStream(txt_BrowseDP.Text & ListBox_Browse.SelectedItem, FileMode.Open, FileAccess.Read)
Dim makeStream As New FileStream(txt_BrowseDP.Text & ListBox_Browse.SelectedItem & ".html", FileMode.CreateNew, FileAccess.Write)
Dim theReader As New StreamReader(openStream)
Dim theWriter As New StreamWriter(makeStream)
Dim BulkContent As String
'Write the FIRST part of content to new file
Try
theWriter.WriteLine("<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN""")
theWriter.WriteLine("""http://www.w3.org/TR/xhtml1/DTD/strict.dtd'"">")
theWriter.WriteLine("<html>")
theWriter.WriteLine("<head>")
theWriter.WriteLine("<title></title>")
theWriter.WriteLine("<meta http-equiv=""content-type"" content=""text/html; charset=UTF-8"" />")
theWriter.WriteLine("<style type=""text/css"" media=""screen"" title=""Default"">@import url(../main.css);</style>")
theWriter.WriteLine("</head>")
theWriter.WriteLine("<body>")
theWriter.WriteLine("")
theWriter.WriteLine("<pre><div</pre> id=""container2"">")
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
'Write the BULK of the content to the new file
Try
theWriter.WriteLine("<p><strong>" & theReader.ReadLine() & "</strong></p>")
While theReader.Peek() > -1
If theReader.ReadLine() <> "" Then
theWriter.WriteLine("<p>" & theReader.ReadLine() & "</p>")
End If
End While
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
'Write the LAST part of the content to the new file and then close
theWriter.WriteLine("</div>")
theWriter.WriteLine("")
theWriter.WriteLine("<p><a href=""#container2"" accesskey=""c""></a></p>")
theWriter.WriteLine("")
theWriter.WriteLine("</body>")
theWriter.WriteLine("</html>")
openStream.Close()
makeStream.Close()
End Sub
-- modified at 19:37 Sunday 9th October, 2005
|
|
|
|
|
Call .Flush() on the stream before you close it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I added theWriter.Flush() and it writes everything now. Thanx.
|
|
|
|
|
You should have called Close on the StreamReader and StreamWriter instead, that way, it automatically flushes AND closes the stream for you.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
crystal reports report
in my Form i Have Sum query like this :
SELECT SUM((Sahar.RegHours * 1 + Sahar.Hour120 * 1.2 + Sahar.Hour125 * 1.25 + Sahar.Hour140 * 1.4 + Sahar.Hour150 * 1.5 + Sahar.Hour175 * 1.75 + Sahar.Hour200 * 2.0 + Sahar.Hour225 * 2.25) * Sahar.MoneyForHour + Sahar.TasNsiot + Sahar.Globaly + Sahar.HefrshySahar + Sahar.Manak - Sahar.HiovMils - Sahar.HiovBigod - Sahar.HiovHanala) AS total, Customers.CustName, Sahar.SalDateStart, Sahar.SalDateEnd, COUNT(*) AS Expr1, Customers.CustAddres, Customers.CustNum, Customers.CustCity FROM Sahar INNER JOIN Customers ON Sahar.CustNum = Customers.CustNum WHERE (Sahar.SalDateEnd >= @Edate) AND (Sahar.SalDateEnd <= @Edate1) GROUP BY Customers.CustName, Sahar.SalDateStart, Sahar.SalDateEnd, Customers.CustAddres, Customers.CustNum, Customers.CustCity
the sum value is changing for every row
i have also a datagrid and the resualt there are good
the problem is when i sending this data to printing in crystal
i dont know how to send the SUM val to the report
is someone here can help me whit that ?
thanks aheed.....
|
|
|
|
|
Hi
I have just finished my first .Net application and am now trying to create a setup project using the VS .net feature.
In the setup I should create some new Registry entries on the target machine which have the installation directory in its value.
My question now is: How can I determine, on which directory the application has been installed? And how can I write then this value into the registry key?
I tried it with the variable "ARPINSTALLLOCATION", but this variable was empty.
Thanks and regards Fredy
|
|
|
|
|
As long as you know how to create the Registry keys in the VS IDE you are in good shape. Create the key, create the value name and then set the value to:
[TARGETDIR]
[TARGETDIR] will be replavced by the app folder.
You can also combine [TARGETDIR] with other strings. You need to be aware that [TARGETDIR] will be replaced by the app install folder with the trailing \ appended.
So, say you want to store the path to your application, for example "MyApp.EXE". Set the value to:
[TARGETDIR]MyApp.EXE
Suppose you user installs to "C:\Program Files\Some Application\". If you create a reg key/value and set the value in your setup to:
[TARGETDIR]MyApp.EXE
then after the setup has run the value will be:
"C:\Program Files\Some Application\MyApp.EXE"
Do NOT do this:
[TARGETDIR]\MyApp.EXE
This will write a value to the registry as:
"C:\Program Files\Some Application\\MyApp.EXE"
Robert
|
|
|
|
|
Hi Robert
Thanks alot for your help. I'll try this as soon as possible.
Regards Fredy
|
|
|
|
|
I wasn't quite sure which forum this should go under, so I put it here.
I, like many others I'm sure, use NDoc to create documentation for my code. This is one great product, but it has one slight drawback. It doesn't document v.2.0 code. The team is working on it.
In the meanwhile I use this little workaround to make NDoc document my V.2.0 projects:
Create a file named NDocGui.exe.config and place it in the NDoc folder (e.g. C:\Program Files\NDoc 1.3\bin\net\1.1).
In this config file you just type:
<configuration>
<startup>
<supportedruntime version="v2.0.50215">
and now NDoc will process the v.2.0 projects. (Supported Runtime Version number should of course be changed to reflect the actual version on your system.)
There is even more good news for VB.Net developers. XML documentation is now supported for v.2.0 projects. Just use ''' (instead of /// for C# projects). This also works with NDoc.
jjrdk
|
|
|
|
|
The XML didn't show up because the browser treated it like HTML, and since it wasn't the browser's renderer just ignored it. You have to remember to either click the "Ignore HTML tags" check box, or manually put in the < and > escape sequences manually.
<configuration>
<startup>
<supportedRuntime version="v2.0.50215" />
</startup>
</configuration>
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
|
How to Get some account's ACLs on a folder?
I want get an account's ACLs on a folder and check the account have specail permission on the folder,for example Read & Write.
I want this is implemented with c# code.
|
|
|
|
|
Hi all,
I am developing painting software for pocket pc using .NETCF. I like to set background for that painting application. I declared one global bitmap variable like this
Bitmap bm = new Bitmap
All images are painted in this bitmap (bm) as shown below.
Graphics.FromImage (bm).DrawLine (new Pen (pnlColor.BackColor), lastPos.X, lastPos.Y, e.X, e.Y);
Now I like to set background for this painted image. I used the following code.
Graphics.FromImage (bm).DrawImage (bmpBackground, 0, 0);
The above code just draws the background image over my painted image. So my painted image is hidden and it shows only the background image. But I like to set the background for my painted image. How to tackle this situation. Thanks in advance.
Regards,
S.Sevugan.
|
|
|
|
|
Does drawing the background first and then drawing the painted image solve your problem?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi Senthil,
Thanks for your reply.In my application,user will draw something and after the completion of the drawing,he used to set the background.So in my case the above solution wont work.Any way thanks for your reply.
Regards,
S.Sevugan.![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
Sevu wrote:
In my application,user will draw something and after the completion of the drawing,he used to set the background
That doesn't matter really, you can always draw the background first and then draw the other stuff. You do all the drawing in the Paint handler, right? You can do something like
void Paint(Graphics g)
{
DrawBackground(g);
DrawEverythingElse(g);
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I have been having a long debate with the developers in my company about porting our MFC software to C++.Net. The main concern is performance really. The software's primary goal is to track the flight of a ball in three dimensions using vision processing techniques. The software is, however, notoriously unreliable, with pointer errors and other software problems causing crashes quite frequently. Many of you may find this laughable but we are still using the VC6 compiler in Visual Studio 6. Aside from that, having had brief interludes with the .Net framework *and* MFC, I feel the .Net framework is far easier to use than MFC and seems to be a lot more stable too. From what I've seen and heard, .Net seems to be the answer in terms of development and productivity.
The other developers argue that the main issue is real-time performance. They feel that trying to get as low-level as we are would be difficult in .Net (but it's not like we're coding in assembly or even C for that matter; just standard C++). I believe they simply have a misguided understanding of how it all works. They seem to believe that the CLR is functionally the same as the Java Virtual Machine and that the intermediate language requires an extra layer of processing. My understanding is that the main purpose of the MSIL is for cross-platform compatibility and that it is possible to compile to the native machine language thus resulting in performance comparable to a Win32 compiled version.
Firsty, is this the correct analysis, and secondly can anyone give me URL where I could find information on benchtests comparing MFC v .Net compiled C++ programs?
|
|
|
|
|
Well, real-time applications are often cited as those for which managed environments are not suitable - due to the non-deterministic garbage collection. However, I don't have experience of real-time myself.
Having said that, Eiffel, which is also a GC-system has been used successfully in real-time environments - though Eiffel is a more sophisticated language than C# and .NET in this regard.
One thing you might get your company to look into is to port the app. to VC++ 2005 (C++/CLI). This will give you a managed environment, using the highest-performing language within a .NET context. Plus I believe it's the only managed language that will support deterministic GC, so that should handle the real-time aspects.
Another alternative is to stick with unmanaged code but port it to VC++ 7.1 or VC++ 2005 (Unmanaged) and make use of Boost smart pointers, etc., to take care of all your memory management issues.
Kevin
|
|
|
|
|
Hi All
We are using C# and VS.NET 2003. It is a mdi application. When
multiple child forms are opened then on the top right and left hand corner recursive
icons
are shown representing each form. There should be only one icon at a time.
Can any body have solution to this problem. Thanks in advance
imran
|
|
|
|
|
I have a List<t> of objects of type Extension. I want to search through the list looking for an Extension e where e.name = "<something>"
How do I do this in the .NET framework? I am confused on the proper syntax.
Thanks,
Lilli
|
|
|
|
|
Like this?
foreach (Extension ext in myList)
if (ext.Name == "SearchString")
Console.WriteLine("Found something!!!");
|
|
|
|
|
Hello,
I have a COM Type Library which contains two structures. One of the structure (STRUCTURE2) contains an fixed array of another structure (STRUCTURE1).
<br />
typedef struct STRUCTURE1<br />
{<br />
float x;<br />
float values[3];<br />
}<br />
RS_STRUCTURE1;<br />
<br />
typedef struct STRUCTURE2<br />
{<br />
STRUCTURE1 items[6];<br />
}<br />
STRUCTURE2;<br />
<br />
interface IrsLoadResults : IUnknown<br />
{<br />
HRESULT GetStructure2([out,retval]STRUCTURE2* pStructure);<br />
}<br />
In my VS.NET project I added reference to this type library and VS.NET generated an interop file. When I call interface method GetStructure2 I get OutOfMemoryException. In VB6 this work correct. I think this is caused by .NET COM marshaling but I don't know how to solve this problem. Does anybody have an idea?
Jirka
|
|
|
|
|
I have been working on a project where the aplication excutable
contains several resource files (text files.)
Now, it is required that the application will be installed at a client
location on 1 machine where the client will generate additional
resource txt files for the application. These files will need to be
packaged with the entire app and then the application will need be
deployed to several other machines.
We have been trying to figure out the best ways to do this.
Is there a way to add the newly generated resource files to a
pre-existing compiled exe? Is it possible?
Laura C
|
|
|
|
|
After an installation the shortcut points appearently not to my application (.exe) but starts the .msi again.
In the user desktop folder of VS the shortcut points to the primary output of the project.
see also this thead
Any ideas?
Thanks
Ariadne
|
|
|
|
|
I rewrote the whole setup-project: Now it works... It seems an internal error.
Then there is probably a minor bug: If I install a project as all users in the Software-install folder the icon is a yellow folder icon. If I install a project as single user the in the setup project selected icon appears.
Ariadne
|
|
|
|