|
Wow.. one line of code... crazy!
"ReceivedAt","External","Hit_Count","Port"
"2010-04-01 00:02:36","211.119.148.217","820","445"
"2010-04-01 00:59:30","221.195.73.86","16","1080"
"2010-04-01 09:49:17","98.105.130.138","14","135"
"2010-04-01 00:59:19","221.195.73.86","14","8000"
"2010-04-01 01:19:57","61.233.103.34","6","1434"
"your ReadFile function is reading a text file line by line and concatenating all; your HTML formatting would probably need the individual lines, so you would have to break it up again, unless you:
- either merge the reading and the formatting code in one function;
- or have ReadFile return a list of text lines."
Not hard for you but very hard for me I know the basics.. I wouldn't even know how to convert the code to a newer .NET version. Would I use Visual Studio?
-lo
|
|
|
|
|
lodogg wrote: Would I use Visual Studio?
Yes, that would be wise.
If you barely know VB, changing to VB.NET is not just an upgrade, the language has evolved and it now uses classes for everything, not just for GUI stuff. I would switch if the code is getting a new lease on life.
You could always outsource.
|
|
|
|
|
I would rather stay with my current old dilapidated code and rewrite it in the future. This is a home system and I outsource implementations all of the time at work but not for a home project.. Any Ideas on how I can format the output into an HTML format?
I take it I would alter code under the
Function ReadFile(txtFile)
I would like to put each item in a column:
"ReceivedAt", "External", "Hit_Count", "Port"
"2010-03-31 00:28:56", "92.47.196.147", "868", "445"
Thanks for all of the responses!!
-lo
|
|
|
|
|
Here is one possibility for formatting the output:
When emitting this HTML code:
<table border='1'>
<tr align='center'><td><strong>title1</strong></td><td><strong>title2</strong></td><td><strong>title3</strong></td><td><strong>title4</strong></tf></tr>
<tr align='right'><td>value11</td><td>value12</td><td>value13</td><td>value14</td></tr>
<tr align='right'><td>value21</td><td>longvalue22</td><td>value23</td><td>value24</td></tr>
<tr align='right'><td>value91</td><td>value92</td><td>longvalue93</td><td>value94</td></tr>
</table>
the result, when looked at with a web browser, could be this (but many variations are possible, either by adding HTML tags, or, better yet, by defining some CSS styles):
title1 | title2 | title3 | title4 | value11 | value12 | value13 | value14 | value21 | longvalue22 | value23 | value24 | value91 | value92 | longvalue93 | value94 |
Whatever you want, the first job of course is to split the input lines in their fields ("valueXY" in my example).
|
|
|
|
|
Luc Pattyn wrote: better yet, by defining some CSS styles
Definitely agree.
Cut and paste from other parts of the code is lazy, but I have been doing it too, but setting up css styles is easier if you want global changes.
Certainly he should switch to VB.NET, much more functionality, and not terribly hard to learn.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
you're getting very good at acting sober on a friday evening/night...
|
|
|
|
|
Ah well you see yesterday was a pseudo-friday, and I was out last night, no work today because we get a holiday in remembrance of nailing the baby jesus to a tree.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
So you cheated; at least you're honest about it!
|
|
|
|
|
True but I want to start on the basics like Sub commands and simple variables and work my way up to the big leagues... he he That will never happen but understanding the code will be a big help.!
|
|
|
|
|
Yep I got the basics on HTML I just don't know how to say take the data between the " " and print the data to the following column, Title 3, Title 4 for example.
"ReceivedAt","External","Hit_Count","Port"
"2010-03-31 00:28:56","92.47.196.147","868","445"
"2010-03-31 09:27:29","98.104.149.153","12","135"
"2010-03-31 10:08:56","87.237.140.163","12","5900"
"2010-03-31 02:49:33","221.195.73.86","12","8000"
"2010-03-31 04:22:26","59.53.88.70","8","2967
<table border='1'>
<tr align='center'><td><strong>ReceivedAt</strong></td><td><strong>External</strong></td><td><strong>Hit_Count</strong></td><td><strong>Port</strong></tf></tr>
<tr align='right'><td>2010-03-31 00:28:56</td><td>92.47.196.147</td><td>868</td><td>445</td></tr>
<tr align='right'><td>value21</td><td>longvalue22</td><td>value23</td><td>value24</td></tr>
<tr align='right'><td>value91</td><td>value92</td><td>longvalue93</td><td>value94</td></tr>
</table>
Good stuff so far..
-lo
|
|
|
|
|
your input looks like a comma-separated-list, and furthermore each field starts and ends with a double quote (which you want removed). I don't know the easiest way to split a string in VB, it has been ages ago I last touched any VB.
|
|
|
|
|
What I'm working on is basically creating a new version of an old server program. The server service receives messages from an oracle database and distributes those messages to all the connected users, a bit like a chat program that only the administrator can talk on. (It's used to inform the client programs when something has changed in the DB so they can always display the most current data.)
Well, we need the new server to handle a whole new type of client that's running on .NET 3.5, but also be backward compatible with the old C++ client.
So the point I'm getting to here is that the system uses named pipes to communicate from server to clients. The way it was designed back in the day (long before I got involved!) had the server calling CreateNamedPipe to open \\.\pipe\serverrouter, and then the clients connected to it by calling CreateFile with \\<server computer>\pipe\serverrouter as an argument.
I've created a server that creates a NamedPipeServerStream and a client that can connect to it, but the old style client can't see that stream at all -- like it doesn't even exist.
As a smaller-scale test I created a new VB.net application and gave it one command:
Dim test As New System.IO.FileStream("\\<server computer>\pipe\serverrouter", IO.FileMode.OpenOrCreate)
Now, here's what brings up my question: If I point that at the computer that's running the old style server, it throws an exception saying "Filestream was asked to open a device that was not a file..." Which is all well and good, I get that -- but when I point it at the computer running the new server program, the exception is "Could not find file". This matches the behavior of the old style client.
What's going on here? Why can't I find the pipe with anything other than a NamedPipeClientStream? A pipe is a pipe, isn't it? How do I get it to at least see the thing? (Actually achieving a connection would be nice too, but I'll settle for being able to see it on the network first!)
|
|
|
|
|
LurkingGryphon wrote: but also be backward compatible with the old C++ client.
Somebody really does not like you. Going down this path is one of the reasons Crystal Reports is such a dog, the reason MS rebuilt some of their tools and completely broke backwards compatibility. I have the feeling that a lot of .net stuff is only consumable by .net. You could try wrapping it as com visible and see if that helps (probably not)
I'd seriously look at the design and the need for backwards compatibility.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I got it figured out finally.
It's a naming convention issue: in the old style named pipe calls (which are in kernel32, I believe), you have to specify the full path: \\.\pipe\pipename (and the users connect to \\servername\pipe\pipename)
But in .net, you only specify the "pipename" part. It automatically prepends the "\\.\pipe" internally on the server pipe, and the client pipe's New takes either a computer name argument or not (in which case it presumes the pipe is local), and prepends either "\\computername\pipe\" or "\\.\pipe\" as appropriate.
So if you use the old style address specification with the .net NamedPipeServerStream constructor, it actually ends up putting your pipe at \\.\pipe\pipe\pipename! That's fine if the other end is a NamedPipeClientStream, which will do the same manipulation and not cause a problem, but if you try to create a stream with one and connect with the other, one of them will be looking in \pipe\pipe\ and be unable to find it.
Judging from the examples I've seen of how to use .net's named pipe classes, this is a very common error.
|
|
|
|
|
Put i a tip & trick, make sure there are the right key word and save it for posterity, or some other poor bugger running up against it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
We have a pair of programs using named pipes with a .NET server app and a native (Delphi, not C++, but still native) client app, so I know this is possible. During development, the programs ran on different machines and the required step to let the programs talk across different users was to use the NamedPipeServerStream overload that took a PipeSecurity. It ended up something like this (namespaces avoided for brevity):
Dim ps As PipeSecurity
ps.AddAccessRule(New PipeAccessRule("Everyone", PipeAccessRights.FullControl,
AccessControlType.Allow))
Dim New NamedPipeServerStream("PipeName", ..., ps)
As I recall, the problem was configuring the security of the pipe to allow users from another computer to connect.
|
|
|
|
|
I did add that code; it didn't fix anything by itself, but once I got the naming convention straightened out (see previous post) everything worked correctly. I don't know if that security specification was really needed, but the thing works with it in, so thanks for posting it.
|
|
|
|
|
Hi all,
Please tel me how to bind a listview using dataset in vb.net application?
Thnaks in advance
|
|
|
|
|
Dim ImageList16 As New ImageList,DAp1 as SqlDataAdapter,Ds1 as New DataSet
ImageList16.Images.Add(Bitmap.FromFile("C:\Temp\party_fig.gif"))
ImageList16.Images.Add(Bitmap.FromFile("C:\Temp\it_spcl.gif"))
ImageList16.Images.Add(Bitmap.FromFile("C:\Temp\target.gif"))
ImageList16.Images.Add(Bitmap.FromFile("C:\Temp\it_dtl.gif"))
ImageList16.Images.Add(Bitmap.FromFile("C:\Temp\it_dtl.gif"))
ImageList16.Images.Add(Bitmap.FromFile("C:\Temp\indent_fig.gif"))
ListView1.Items.Clear()
ListView1.Refresh()
ListView1.View = View.Details
ListView1.BorderStyle = BorderStyle.FixedSingle
ListView1.BackColor = Color.Azure
ListView1.ForeColor = Color.Green
ListView1.HoverSelection = True
ListView1.FullRowSelect = True
ListView1.HeaderStyle = ColumnHeaderStyle.Nonclickable
ListView1.GridLines = True
ListView1.Cursor = Cursors.Hand
ListView1.Columns.Add("MT No", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("MT DATE", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("ITEM_DESCRIPTION", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("ITEM_CODE", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("TRANSFER Qty", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("UNIT", -2, HorizontalAlignment.Left)
ListView1.Columns.Add("PROJECT", -2, HorizontalAlignment.Left)
ListView1.SmallImageList = ImageList16
ListView1.Columns(0).ImageIndex = 0
ListView1.Columns(1).ImageIndex = 1
ListView1.Columns(2).ImageIndex = 2
ListView1.Columns(3).ImageIndex = 3
ListView1.Columns(4).ImageIndex = 4
ListView1.Columns(4).ImageIndex = 5
ListView1.Columns(4).ImageIndex = 6
ListView1.Font = New System.Drawing.Font("Times New Roman", 8, FontStyle.Regular, GraphicsUnit.Point, Byte.MinValue)
Private Sub ComboBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.Click
Ds1.Clear()
ComboBox1.DroppedDown = True
con.ConnectionString = ConStr_2
con.Open()
DAp1 = New SqlDataAdapter(Query1, con)
DAp1.Fill(Ds1)
con.Close()
ListView1.Items.Clear()
ListView1.Refresh()
For A3 As Integer = 0 To Ds1.Tables(0).Rows.Count - 1
Dim RItem As ListViewItem
RItem = New ListViewItem(Ds1.Tables(0).Rows(A3).Item("mt_no").ToString)
RItem.SubItems.Add(Ds1.Tables(0).Rows(A3).Item("mt_date").ToString)
RItem.SubItems.Add(Ds1.Tables(0).Rows(A3).Item("itm_description").ToString)
RItem.SubItems.Add(Ds1.Tables(0).Rows(A3).Item("itm_code").ToString)
RItem.SubItems.Add(Ds1.Tables(0).Rows(A3).Item("tran_qty").ToString)
RItem.SubItems.Add(Ds1.Tables(0).Rows(A3).Item("itm_units").ToString)
RItem.SubItems.Add(Ds1.Tables(0).Rows(A3).Item("proj_name").ToString)
ListView1.Items.Add(RItem)
Next
ListView1.Visible = True
ListView1.Focus()
End Sub
|
|
|
|
|
|
Hi,
i hope this can be answered in this Message Board.
I have some VBA code in Access 2007 that opens up a table in Print Preview mode. I want the orientation to be in landscape.
Here is the code that puts it in Print Preview mode:
Dim prtPrintPreview As Printer 'trying this to no avail
stDocName = "MyDataTable"
DoCmd.OpenTable stDocName, acViewPreview
Set prtPrintPreview = Application.Printers(0) 'this did nothing
prtPrintPreview.Orientation = acPRORLandscape
When the table opens, it is put in Print Preview (this is the only Access2007 menu tab available).
|
|
|
|
|
Hi,
You can change the default orientation like this[^];
Application.Printer.Orientation = acPRORLandscape
stDocName = "SomeTableName"
DoCmd.OpenTable stDocName, acViewPreview
I are Troll
|
|
|
|
|
THANK YOU!
I was looking all over the Net and MSDN for about 2 hours (and even contracted a suspicious "file") in the process.
This did exactly what i needed.
Thanks again,
John JM
|
|
|
|
|
Can I raise my own compilation error.
For example if an object gets used before a property is set can I raise that as an error when we compile?
Humble Programmer
|
|
|
|
|
programmervb.netc++ wrote: Can I raise my own compilation error.
That would be easy in C#;
#warning "You've been warned!"
#error "about a warning and an error"
Alas, VB.NET doesn't seem to have an equivalent. The closest match would be misusing the Obsolete -attribute;
<Obsolete("Danger, Will Robinson!", True)> _
Sub Test()
End Sub
I are Troll
|
|
|
|
|