|
That's because there's nothing wrong.
Open the project in the Solution Explorer and look for your .MDB file. Click once on it, then in the Properties box, there'll be an option called "Copy to output directory". Change it's value from "Copy always" to "Copy if newer". That way, if you delete the copy of the database file in the bin folder, Visual Studio will replace it the next time you compile the project.
|
|
|
|
|
I'm trying to use .Net 3.5's NamedPipeServerStream and NamedPipeClientStream and I'm having some problems. I'm able to send one commmunication between the client and server programs but when the client attempts to connect a second time it hangs. Any idea what I'm doing wrong?
SERVER CODE
-----------
Imports System
Imports System.IO
Imports System.IO.Pipes
Imports System.Threading
Imports System.Windows.Forms
Public Class SimServer
Private Delegate Sub InvokeDelegate(ByVal text As String)
Private newThread As New Thread(New ThreadStart(AddressOf PipeServer))
Private Sub PipeServer()
' Read the request from the client. Once the client has
' written to the pipe, its security token will be available.
Dim pipeServer As New NamedPipeServerStream("CognexPipe", PipeDirection.InOut, 10)
Dim sr As New StreamReader(pipeServer)
Dim sw As New StreamWriter(pipeServer)
Dim line As String
Dim retline As String
While (1)
pipeServer.WaitForConnection()
sw.AutoFlush = True
While (pipeServer.IsConnected)
If (sr.Peek > 0) Then
line = sr.ReadLine()
Me.BeginInvoke(New InvokeDelegate(AddressOf TextHandler), line)
retline = "Received: " + line
sw.WriteLine(retline)
End If
End While
End While
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
newThread.Start()
End Sub
Private Sub Form3_Close(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.FormClosing
newThread.Abort()
End Sub
Public Sub TextHandler(ByVal text As String)
ReceivedBox.Text = text
ReceivedBox.Update()
End Sub
End Class
CLIENT CODE
-----------
Imports System
Imports System.IO
Imports System.IO.Pipes
Imports System.Threading
Public Class SimClient
Private Sub SendButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendButton.Click
Dim pipeClient As New NamedPipeClientStream(".", "CognexPipe", PipeDirection.InOut)
Dim sr As New StreamReader(pipeClient)
Dim sw As New StreamWriter(pipeClient)
Dim line As String
Dim retline As String
If Not pipeClient.IsConnected Then
pipeClient.Connect()
End If
If pipeClient.IsConnected Then
sw.AutoFlush = True
line = CommandBox.Text
sw.WriteLine(line)
While sr.Peek = 0
End While
retline = sr.ReadLine()
ResponseBox.Text = retline
ResponseBox.Update()
sw.Close()
sr.Close()
End If
End Sub
End Class
Thanks for any help you all can give me.
George
|
|
|
|
|
Based on what I can see from the code without actually compiling it, I would guess that either the server code is blocking on the line If (sr.Peek > 0) or the thread is throwing an Exception when the pipe closes and ending that thread.
|
|
|
|
|
Q. Did you ever figure this out?
I'm trying to build a chat using NamedPipeServerStream & NamedPipeClientStream..
|
|
|
|
|
Hi,
I am trying to find out a way to call a class with the value of a variable, i havent had any solution yet. I appreciate any help.
basically what i want to do is like this :
public sub CalllaClassByName(byval strClassName as string)
dim mynewclass as new strClassName
end sub
i know i can do this like this
public sub CalllaClassByName(byval strClassName as string)
select case strClassName
case is ="clsProducts"
dim myNewClass as new clsProducts
case is ="clsCustomers"
dim mynewClass as new clsCustomers
case is ="clsProducers"
dim mynewclass as new clsProducers
end select
bindingsource1.datasource=mynewclass
end sub
i think PHP has something like this (i am not sure)
$Myclass="clsProducts"
$$myclass.Price=10
Thanks.
modified on Monday, October 27, 2008 11:48 AM
|
|
|
|
|
I believe that you are trying to solve this like you would do in a script language like PHP. Eventhough it's possible to do using reflection, or more efficient using a select as you suggested, there is probably a more object oriented way to solve it.
What is it that you want to accomplish, really?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
thanks Guffa,
Of course there is a way. i can create a new class and call the related class but it's not the quicker way(or i dont think so).
let me explain what i want to do.
i am using mysql as a database server. I created only a form which has a datagridview inside to add new products, customers, warehouse etc. and i have a class for every single definition tables(clsproducts,clswarehouses, clscustomers) which inherits dataset class. i wanna bind datagridview to a class for the thing i wanna add some new records.
basically i can use select case function as i wrote down. but if there is a way to do this just like or similar with php scripting language, i would like to know this.
coud you tell me how to do this with reflection, cos i made some reserach for the reflection but i couldnt find anything to helo me.
Thanks again.
|
|
|
|
|
Reflection is slow, so if you're creating objects for thousands of customers, you'll run into some serious performance bottlenecks. I think what you're looking for is a "Factory class". Google it for some research to see if it'll fit your needs.
|
|
|
|
|
Thanks Dave,
I think i am going to use select case to make a new instance of related class.
What i want to know is, isnt it possible to use variable as a variable type just like i wrote before like PHP script.
$var1="products"
$$var1.Text="Test"
which means product.text="test"
i have some strongly typed dataset classes and i wanna bind only one datagridview to one of the classes which is selected. i am doing this to add new records to different tables. for example when i bind the datagridview to the products class instance, i am gonna add some new products and when i bind the datagridview to customer class instance, i am gonna add some new customers. otherwise i have to create new form for every tables in my database.
thanks again.
|
|
|
|
|
Member 896436 wrote: What i want to know is, isnt it possible to use variable as a variable type just like i wrote before like PHP script.
No, you can't. This ain't PHP.
Member 896436 wrote: otherwise i have to create new form for every tables in my database.
No you don't. You just have to supply the code to bind the DGV to it's columns and bind it to the correct collection.
|
|
|
|
|
|
Hi...I'm new to vb.net..I would like to incorporate the vista glass effect in my vb.net app,
but I can't find any examples to do this...I know how to make the form into glass form, but
can't get the controls on it to act normal...the text on them disapeares when the form is
glass...help would be greattly appreciated..
also there is a way to incorporate the office ribbon, or at least the button, in vb.net apps?
|
|
|
|
|
Is your application written using WPF?? If not, there's pretty much nothing you can do.
|
|
|
|
|
Have you done a search on this site? Their are quite a few examples of glass effect in WinForms/WPF apps.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Hi all ,
I am working on the VB.net project , which downloads text files to my local directory from a server.
Sample text file is provided below
! 07-08-30 05:12:12 00 0002.1159 Information: Component in tape
! 07-08-30 05:13:03 00 0002.1548 Information: RIT1
! 07-08-30 05:16:27 00 0002.1245 Information: End-of-reel
! 07-08-30 05:16:27 00 0002.0027 Question: End of reel?
! 07-08-30 05:16:29 00 0002.1217 Information: Read in lot
My problem is this log file on the server generates new entry every few minutes and when i run my VB program i want only the new line to be updated on the local file.
In other words I want the text file on my local directory to be updated with new lines from the text files located on the server.
Can some one please help me with the code to do the text file updating. Thanks
|
|
|
|
|
Open both files, read through matching off until you reach the end of your local file, re-open it for append and add the records.
If you know the server file is ONLY adding you could do it by counting the number of rows in your local file, and read to that line in your server file before appending, but there is no magical way to do it.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I am using MS visual dot NET. How can I show an image on Tooltip (Window application) and some thing like that? Because I want to show image of each Employee when cursor move on each row in datagrid. On web application we can use javascript. But this ia Window application. Please give me somes solutions. Thank you so much
asdasda
|
|
|
|
|
Why are you crying?
Simple. You can capture the MouseEnter event, and show a form in that event. In that event, make sure the Left, Top of form coincides appropriately with that of the Control. The form can consist of the PictureBox (which can be used to show the image according to the control. This can be done by setting a Public Shared variable of the parent form and changing the value to the appropriate image url) and other controls for working with the image.
And on MouseLeave you just close the form.
Make sure you make the form looks like a splash screen by changing her properties. BTW you can as well use a PictureBox control directly if you don't want the tooltip to be visible outside your form. I just thought of a more general case when user can probably perform some operations on the image.
-------------------------------------------
It's code that drives you - Shyam
modified on Monday, October 27, 2008 8:09 AM
|
|
|
|
|
Thank you Shyam ... you help me to solve this problem. My firend. I'm from VietNam. where are you?
asdasda
|
|
|
|
|
Moi from india...
|
|
|
|
|
oh. India have very big software industry. I know, India is number software industry in the world. Nice to meet you. My Email is : quyphidao@yahoo.com. Could I have your email? I hope we will be good friends and help each other to improve knowledge....
asdasda
|
|
|
|
|
Please tell me the hex code of N
Arindam Banerjee
Sr. Software Developer
Rance Computer Pvt Ltd.
Kolkata (India)
|
|
|
|
|
Doesn't Google work in India?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Ashfield wrote: Doesn't Google work in India?
Yes it does. But the guy is a senior software developer @ Rance Computer Pvt Ltd. So googling seems to be a bit low for his position I guess
-------------------------------------------
It's code that drives you - Shyam
|
|
|
|
|
If google is too mainstream, you can always use the 1208930147 search engine.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|