|
Maybe this might help ...
A POP3 Client in C# .NET[^]
Sounds like a "doable" project.
1) People can enter questions to management
2) Questions are forwarded to management for response
3) Management reponses via email
4) Response is forwarded to the anonymous user and possibly posted on a Intranet server.
Sounds cool ...
One thing for sure is that you will need a dedicated email account for the website to read/write emails from. Also, make sure that you "whitelist" the users that can respond to this email account, you don't want to process emails about Viagra. You will have to keep some sort of ID in the subject line so that when the response is processed from management, it gets posted to the correct question.
This project will keep you busy for a while.
|
|
|
|
|
Good ideas...I'm in the process of building on a similar idea. Your feedback will be the grounds for added feature sets.
modified on Wednesday, January 27, 2010 10:00 AM
|
|
|
|
|
Hi all.
Right first off - ive only just installed vb.net (2008), im well used to VB6, but never switched as i could get 6 to do everything i needed. so go easy on me! (assume i now nothing).
im doing a little project for fun, im building a tracking paintball gun. however im new to image processing so im looking for a little help.
What i need to do is to caputre an image from 2 webcams (set at an angle to each other to capture a wide image) at the same time, which cover the paintball field (they may overlap very slightly). I then need to stitch these 2 images together, and create some sort of array of colour values (or maybe i could make 2 arrays first and join them, probably easier)
I then need to somehow detect moving objects between this array, and the previous array(s)
i think some sort of edge detection / high pass filter would help too.
so the 2 main things i need help with are:
Image capture, and extracting colour information per pixel.
oh and the code needs to be efficient enough to do this at a frame rate of approx 10fps
if possible i dont want to use someone else's code to do this, i would like to work it from scratch
|
|
|
|
|
Well.
I try to display the datagridviewbuttoncell, acording to the value of the cell. But I can't succeed. I tried by the following ways.
I mean, suppose....
Private Sub DataGridView1_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEnter
Dim r1 As Integer = e.RowIndex
If Len(Trim(DataGridView1(1, r1).Value)) <> 0 Then
Dim BnCell As New DataGridViewButtonCell
DataGridView1(2, r1) = BnCell
Else
Dim TxtCell As New DataGridViewTextBoxCell
DataGridView1(2, r1) = TxtCell
End If
End Sub
So, like the above if the data is available in column(1), then column(2) of currentcell will be datagridviewbuttoncell
or else datagridviewtextboxcell
Any better ideas for me?
Thanks
|
|
|
|
|
I'm working on a utility to do a find replace operation on Word documents (2003 version not docx)
We've a version of this that uses automation, however it's too slow, and runs into problems with documents linked to excel, and containing macros (and anything else that causes messages to show).
I've got code sorted out that will do this finding and replacing the bytes in a byte array of the file (see below). This works perfectly as long as the length of the bytes I replace is the same as the length of the bytes I need to find. If I change the length of the file the document will no longer open in word.
When I make the change required manually (ie through MS Word), the byte length of the file doesn't change, so I'm assuming there must be a buffer somewhere in the file that is getting used.
Please give me feedback on how to update the file correctly.
Code:
(please excuse the rough nature of this code - I'm prototyping!)
(also DoReplace is based on code downloaded from T'Interweb. Can't remember where, but if its yours, thanks!)
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim find As String = "String To Find"
Dim replace As String = "String To Replace"
Dim path As String = "c:\InputPath.doc"
Dim updatedpath As String = "c:\OutputPath.doc"
Dim encoding As System.Text.Encoding = System.Text.Encoding.GetEncoding(1252)
Dim fi As New FileInfo(path)
Dim fs As New FileStream(path, FileMode.Open)
Dim bytes(CInt(fs.Length)) As Byte
fs.Read(bytes, 0, CInt(fs.Length))
fs.Close()
Dim newBytes() As Byte = DoReplace(bytes, encoding.GetBytes(find), encoding.GetBytes(replace))
fs = New FileStream(updatedpath, FileMode.Create)
fs.Write(newBytes, 0, newBytes.Length)
fs.Close()
End Sub
Public Function DoReplace(ByVal bytes As Byte(), ByVal findBytes As Byte(), ByVal replaceBytes() As Byte) As Byte()
Dim newBytes As New Generic.List(Of Byte)
Dim ndx As Integer = 0
For x As Integer = 0 To bytes.Length - 1
' bytes is the original files bytes
If bytes(x) = findBytes(ndx) Then
' findBytes is a byte[] from the"find" string
If ndx = (findBytes.Length - 1) Then
For y As Integer = 0 To replaceBytes.Length - 1
'replaceBytes is a byte[] from the "replace" string
newBytes.Add(replaceBytes(y))
Next
ndx = 0
Else
ndx += 1
End If
Else
If ndx > 0 Then
For y As Integer = 0 To ndx - 1
newBytes.Add(findBytes(y))
Next
End If
ndx = 0
newBytes.Add(bytes(x))
End If
Next
Return newBytes.ToArray
End Function
End Class
|
|
|
|
|
You need to understand the structure and format of a Word file before you can reliably change anything. Changing a number of bytes in the file without knowing exactly what those bytes may be used for is a recipe for disaster.
|
|
|
|
|
Yeah - got it to work after a fashion - by adjusting the empty bytes that are found after the main content of the doc. However handing headers footers and everything else is (as you say) horrible.
I think if I had another couple of years I might take this further, however, I'm off Xmas shopping instead!
|
|
|
|
|
I know it will run somewhat slower, however ...
How about using Office Automation to open each doc, do the string substitution and save the resulting doc. We did some work recently that thankfully involved docs saved in WordML format. Resaving in the middle of your process as WordML may make the substitution easier.
|
|
|
|
|
The '95 versions didn't save an entire document, but they appended changes to the last part of the document. That's a bit faster than writing the entire document anew.
You can find the documentation through the link below. Be warned though, there's dragons there
http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/Word97-2007BinaryFileFormat(doc)Specification.pdf
I are Troll
|
|
|
|
|
Eddy Vluggen wrote: there's dragons there
They are everywhere[^].
|
|
|
|
|
Now there's a gem that I still need to revisit.
..I'll plan it right after the course on time-management
I are Troll
|
|
|
|
|
Thanks for the info.
There are indeed Dragons! - Unfortunately this has to work on thousands of documents (corporate rebrand!) and there's no way I can guarantee that every doc will work within my timescales.
We'll just have to get a temp to click on the message boxes that pop up (that are unstoppable!)
|
|
|
|
|
jonegerton wrote: Unfortunately this has to work on thousands of documents (corporate rebrand!)
So I guess you have been tasked with replacing all occurences of "Tiger Woods" with "Tom Watson" or something along those lines?
I tried to make something like that work years ago, i.e. something that tried to re-create the Word "save" logic at a low level. My recollection is that somewhere in the file, there is a field holding the length of the data or (less likely) a checksum. I thought I was adjusting that properly, but never did manage to create "valid" Word documents. Apparently there was some other checksum somewhere that I did not know about. Eventually I ended up doing the job with automation. I managed to work through the message-box-related issues... I think there are ways to detect the error condition and kill Winword.exe. In the worst case, you could just assume an error occured after a certain length of time.
None of this is beautiful, but in the end it proved more workable than manually messing around with the file. And I did try mightily to make that work... I was just out of college, and had been immersed in a thesis that used Intel assembly, and the low-level approach was definitely the one I preferred.
One more thought: the "DOCX" format of Office 2007 is much more regular and well-documented than the old melange of DOC formats. I think a DOCX is basically a zipped-up collection of XML documents and embedded image files. Have you considered converting to DOCX as the first step of the process? It might make your life easier.
|
|
|
|
|
I need to find the encoding of a file that I've opened through code so that I can convert strings to byte arrays using the same encoding.
This includes word documents - the one I'm testing is Windows (1252) - according to EditPad,
The normal examples that return the variations on UTF8/Unicode are not sufficient.
Is there a way to acheive this?
In the course of my code I'm opening the documents as byte arrays via a filestream, so some way of extracting the encoding from there would be most useful.
Thanks in advance for your help
For more information on what I'm actually trying to acheive, see my other post: http://www.codeproject.com/Messages/3303167/Replacing-Bytes-in-an-Office-2003-Word-Document.aspx[^]
modified on Monday, December 14, 2009 9:29 AM
|
|
|
|
|
|
Hi,
I want to automatically expand Combo box on focus event.
I have set the Droppeddown = True in gotfocus event, but this has a side effect. When click event gets fired, it expands dropdown and closes immediately. How can I avoid it?
Mithun Shitole
"Free Your Mind"
http://www.technoyaari.com
modified on Monday, December 14, 2009 5:11 AM
|
|
|
|
|
Dear All,
I have problem with calendar.
I had created popup calendar with text box.
when i select month or year it always close the calendar like when i select day.
It is differenc datetime packer.
Do you have any idea or source code for my issue ?
Thanks you for your help ...
VB.Net
|
|
|
|
|
I totally don't understand your question, if one exists at all. Can you please rephrase your question so that a suitable answer can be thought of? Until then, liquid nitrogen.
|
|
|
|
|
Thanks,
That issue i solved it already.
But i have another thing that.
like DateTime Packer i want to show only Month & Year.
doese it has property for do that or not ?
How can resovle it ?
VB.Net
|
|
|
|
|
I would explore the relevant classes in the documentation at http://msdn.microsoft.com
|
|
|
|
|
Strange title... but i wan't to explain your what i mean.
I have a form, with one textbox. This textbox should be useable with commands such as examples:
/title TITLE OF FORM
so the form title is TITLE OF FORM (without /title infront) - I have tried with splits, serveral of string formats and much more but without any luck and i don't seem to find it on google with search tags: TextBox, Command, Strings etc.
I hope you can help me with this, if you don't have any idea what i am talking about, you can ask in this thread and i can try to explain.
I use Visual Studio 2008 VB Form
|
|
|
|
|
Should be relatively easy, just use a select case statement on the first word in a text box, and use a default case for unknown commands. I did something similar for a chatbot...
|
|
|
|
|
A strange title deserves a strange answer. I've divided this into three smaller tasks, each with code;
dim input as string = "/title HELLO"
This is where you get the command from the user. Next, you'd need to split this in the portion that represents the command (e.g. "/title"), and the portion that represent the arguments (e.g., "HELLO")
dim indexOfSpace as integer = input.IndexOf(" ")
dim command as string = input.SubString(1, indexOfSpace - " ".Length)
dim args as string = input.SubString(indexOfSpace)
Lastly, you'd need something to apply these new values.
Select Case command
Case "title": Text = args
Case "color": Color = Color.FromName(args)
End Select
Good luck
I are Troll
|
|
|
|
|
I'm trying to make a client to a text based game. I've asked the question before, but now I've got a little bit more to work with. What I need is some help with it. I'll show the code first.
Code for my 'tcpListener' which I've actually added to my overall project as a Console Application - Module1
Imports System.Net.Sockets
Imports System.Text
Module Module1
Sub Main()
Dim tcpListener As New TcpListener(6100)
Dim requestCount As Integer
Dim clientSocket As TcpClient
tcpListener.Start()
msg("Server Started")
clientSocket = tcpListener.AcceptTcpClient()
msg("Accept connection from client")
requestCount = 0
While (True)
Try
requestCount = requestCount + 1
Dim networkStream As NetworkStream = _
clientSocket.GetStream()
Dim bytesFrom(10024) As Byte
networkStream.Read(bytesFrom, 0, CInt(clientSocket.ReceiveBufferSize))
Dim dataFromClient As String = _
System.Text.Encoding.ASCII.GetString(bytesFrom)
dataFromClient = _
dataFromClient.Substring(0, dataFromClient.IndexOf("$"))
msg("Data from client - " + dataFromClient)
Dim serverResponse As String = _
"Server response " + Convert.ToString(requestCount)
Dim sendBytes As [Byte]() = _
Encoding.ASCII.GetBytes(serverResponse)
networkStream.Write(sendBytes, 0, sendBytes.Length)
networkStream.Flush()
msg(serverResponse)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End While
clientSocket.Close()
tcpListener.Stop()
msg("exit")
Console.ReadLine()
End Sub
Sub msg(ByVal mesg As String)
mesg.Trim()
Console.WriteLine(" >> " + mesg)
End Sub
End Module
And this is my code for the actual client
Imports System.Net.Sockets
Imports System.Text
Public Class lokMudClient
Dim clientSocket As New System.Net.Sockets.TcpClient()
Dim serverStream As NetworkStream
Private Sub btnConnect_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnConnect.Click
Dim serverStream As NetworkStream = clientSocket.GetStream()
Dim buffSize As Integer
Dim outStream As Byte() = _
System.Text.Encoding.ASCII.GetBytes("Message from Client$")
serverStream.Write(outStream, 0, outStream.Length)
serverStream.Flush()
Dim inStream(10024) As Byte
buffSize = clientSocket.ReceiveBufferSize
serverStream.Read(inStream, 0, buffSize)
Dim returndata As String = _
System.Text.Encoding.ASCII.GetString(inStream)
msg("Data from Server : " + returndata)
End Sub
Private Sub lokMudClient_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
msg("Client Started")
clientSocket.Connect("204.209.44.6", 6100)
outputBox.Text = "Client Socket Program - Server Connected ..."
End Sub
Sub msg(ByVal mesg As String)
outputBox.Text = outputBox.Text + Environment.NewLine + " >> " + mesg
End Sub
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOptions.Click
dialogsForm.Show()
End Sub
End Class
Now, for some reason, I can't see any output in my 'outputBox' which I've set inside a panel labelled 'outputHolder.' So, I'm a little lost as to which direction I need to be going with this. I thought I had it down, but I guess I don't....
P.S. I'm not getting any errors, but I am getting a warning which reads:
"'Public Sub New(port As Integer)' is obsolete. 'This method has been depracated. Please use TcpListener(IPAddress localaddr, int port).'
And it can be found on line 5, column 13 of the tcpListener project. Could this be the reason I'm not finding any text in the rich text box I'm trying to use to hold the output of the server? Suggestions, fixes, please provide and thank you in advance.
|
|
|
|
|
Hello,
I am new to this forum, and a begginer programer.
I am looking for some advice on how to use a button control to open the openfiledialog which displays a picture on a form.
Here is the code i currently have, it works except for the fact that the openfile dialog just repeatedly comes up even after i choose the file to open. I only want the file to open when i hit button2.
Public Sub drawonform(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim button2 As Boolean = False
If button2 = True Then
If (Form1.openDiag.ShowDialog() = Windows.Forms.DialogResult.OK) Then
user = Form1.openDiag.FileName
End If
End If
' Create image.
Dim Newimage As Image = Image.FromFile(user)
' Create Point for upper-left corner of image.
Dim ulCorner As New Point(100, 100)
' Draw image to screen.
e.Graphics.DrawImage(Newimage, ulCorner)
End Sub
modified on Friday, December 11, 2009 3:59 AM
|
|
|
|
|