|
I am using parallel port in my design project.May you please give me a detailed description how to do so.My I design is based on controlling the following outputs 12V stepper motor,buzzer and traffic lights(3 Leds).
I am using 2 motion detector (both main and the backup) to sense the train and pressure sensor to detect the car(this are my inputs).
Please help I am submitting this project on 3 of November2008.Please help I was trying since july.
modified on Monday, October 27, 2008 6:45 PM
|
|
|
|
|
One week to do this?? Good Luck with that! You'll find it very difficult to do this with the parallel port. Too limited in functionality and interfacing between the hardware and your code. You can do this much easier using USB devices. Check out Trossen Robotics[^], starting with a Phidgets board and the sensors and motor controllers they have.
|
|
|
|
|
im new in using ole db and i could'nt solve my problem here. not sure if im missing some codes.
after clicking the save button and closing the program, when you open it again, the record will not show (not actually saved!). I need to add, edit and delete a record.
please help. thanks.
If strMode = "addmode" Then
dr = dt.NewRow()
dr("ISBN") = txtISBN.Text
dr("Title") = txtTitle.Text
dr("Year Published") = txtYear.Text
'dt = ds.Tables(0)
dt.Rows.Add(dr)
myAdapter.AcceptChangesDuringFill = True
dr.AcceptChanges()
dr.BeginEdit()
Me.myAdapter.Update(ds)
MessageBox.Show("Added new record!")
ElseIf strMode = "editmode" Then
'cm = currencymanager
dt.Rows(cm.Position).Item("ISBN") = txtISBN.Text
dt.Rows(cm.Position).Item("Title") = txtTitle.Text
dt.Rows(cm.Position).Item("Year Published") = txtYear.Text
Me.myAdapter.Update(ds)
MessageBox.Show("Record Updated!")
End If
|
|
|
|
|
Are you using an Access database?? Does this happen running your code deployed to a test workstation??
If not, then it's probably because your orignal copy of the database is getting copied to the bin\Debug or bin\Release folders every time you compile your app. You run your app in the debugger and make some changes. Those changes are written to the copy of the database in the bin folder. Once you stop your app and rerun it, those changes are probably getting overwritten because Visuaal Studio is copying the .MDB file to the bin folder again, over the top of your changed .MDB file.
|
|
|
|
|
Yes im using access.
so what will i do? should i change my codes? it doesn't give an error message and i can't trace anything wrong.
Thanks.
|
|
|
|
|
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...
|
|
|
|