|
Dear expert,
I have used VB.NET with serial port to recivev data from Fire alrm. Data is same as one that printed.
I user Hyperterm to connect and it can receiv data correctly. BUT when I try to connect with VB.NET the message appear gargabe,which seems like you have delected incorrect parameter.
I have try many apps and it appear to be same. The only work is hyerterm so mu question :
Does Hypterm do any thing with input ?
How can we deal with this situation ?
in .NET, data must be converted or not ?
sanong
|
|
|
|
|
Actually Hyperterminal does nothing special other than handling properly serial communication (!).
I suggest you to check Hyperterminal serial communication settings and try to reproduce them in you application.
If the application still remains unable to communicate, post the relevant code.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi Pallini,
Thank you for reply.
I am really stuggling with this behaviour. Let me tell you more details:
We have Notify NFS 640 fire alarm panel,and I am writing Simple Terminal to capture alarm data from Printer Port(from panel TX\RX\CS). Printer epson is also connected same port (split cable) and it print fine. But on the other end, I have tested my program, Microsoft's VBTerm, PowerTCP emulator, and others, all failed to obtain correct data from port. Below are samples of actual data which taken from same source but from different programs. So I am not sure what is so special with HyperTerm that it can interpret correct data and other program cannot.
Incorrect output from:VBterm,PowerTCP, and others
=======================================
SYSิลM าลSลิ 0ฒ:ด0P 05ฒ60ท
Correct output from HyperTerm
=============================
SYSTEM RESET 09:36A 052707 Sun
I am suspecting :
1. text sent from panel has encoded for printer which I dont know about
2. or other unknow issue
I welcome all recommendation.
thank you in advance,
|
|
|
|
|
Hyperterminal is using one set of COM parameters and everything else you've used is using another set. These include Baud rate, data bits, stops bits, even or odd or no parity, handshaking, ... Write down ALL the communication parameters that HyperTerminal is using and duplicate them in your code.
|
|
|
|
|
|
Hi All
I want ask you how can i use tree wiew in VB.NET to brows for folders
in specific drive(c:\,d:\,.....)
i want to view all files and i want to open them when them clicked
(i want VB.NET code to implemnt this problem in other words my problem seem like Tree of folders in windows when we select folder all it's content are open beside it and we can select any file by click on it)
|
|
|
|
|
i am not sure what you are looking for but you can use the OpenFileDialog found in VB.NET
if this is not good for you and you want to implement something like windows explorer you have to write your own code to browse files and folders and add them to the tree view.
hope this helps you
|
|
|
|
|
Thank You Sir
I need to know how to implement something like windows explorer
(My problems looks like when we open My Computer and then click on the icon Folders we see tree on the left of the screen and on the right we see all files and folder in specific directory I need to implement this)
I look forward to hear from you soon
|
|
|
|
|
<br />
Dim Files() As String = System.IO.Directory.GetFiles("c:\")<br />
Dim Folders() As String = System.IO.Directory.GetDirectories("C:\")<br />
<br />
For Each F As String In Folders<br />
If (System.IO.File.GetAttributes(F) And IO.FileAttributes.Hidden) <> IO.FileAttributes.Hidden Then<br />
Me.TreeView1.Nodes.Add(F, F.Split("\")(F.Split("\").Length - 1))<br />
End If<br />
Next<br />
<br />
For Each F As String In Files<br />
If (System.IO.File.GetAttributes(F) And IO.FileAttributes.Hidden) <> IO.FileAttributes.Hidden Then<br />
Me.TreeView1.Nodes.Add(F, F.Split("\")(F.Split("\").Length - 1))<br />
End If<br />
Next
you can use something simillar to this code. this code only adds files and folders under the c:\ directory. you can extend this code to add other files under each folder. the best way is to make the function a recursive function but this will make your program very very slow. what i suggest is call this function everytime a node is clicked this add the childern of that node using this function. the nodes.add function can be extended to include icons to differ between a file and a folder.
to add a child node you can use the following line:
me.TreeView1.Nodes.Item(me.TreeView1.Nodes.IndexOfKey(Key)).Nodes.Add()
where the key is what i specified in the first argument of the Nodes.add line (= F)
hope this helps, if you need further help please let me know
Khalid
|
|
|
|
|
Dear Sir
I thank you very much
I know how to fill tree and I use the following
<br />
Dim aDriveAs String<br />
For Each aDrive In Directory.GetDirectories("E:\")<br />
If (File.GetAttributes(aDrive) And IO.FileAttributes.Hidden) <> IO.FileAttributes.Hidden Then<br />
T.Nodes(0).Nodes.Add(aDrive)<br />
End If<br />
Next
But I need the following
When I select folder from tree I want to display All files and Folders
on a panel or somthing like this,i.e. in the same way as (windows explorer)
so I can Open,Copy or delete any file or folder
Thank you again
|
|
|
|
|
i am not sure if i understod you correctly but you can use the AfterSelect event of the treeview control and you can get the name of the node by using the following line
MsgBox(e.Node.Text)
but for your code, it will be harder to read because you are including the entire path of each file which makes it hard for the user. What i suggest is use the same code as mine (add only the name of the file and use the Name property of the node to store the whole path. if you do this, then you would have to use the line:
MsgBox(e.Node.Name)
instead of the first one. after you get the path of the selected node, then you can use a list view control to display files and folders and do whatever you want to do with them.
hope this makes things more clear.
Khalid
|
|
|
|
|
Dear Sir
Ithank You and I am Very Sory
But Now my problem is can I use a list view control to display files and folders and do whatever you want to do with them.
I need to know how can I display files and folders as larg icons
|
|
|
|
|
to add items you just need to call ListView1.Items.Add("aa" ,0) to add an item called "aa" with icon index of 0
the index of the icons is found from an ImageList control that you have to add and insert images into.
after adding the ImageList, you have to specify the Me.ListView1.LargeImageList = Me.ImageList1 to define the large images of the items and then change the image size in the ImageList to 32,32.
by default, the ListView control displays LargeIcons (after setting up the steps before) but just in case you have to specify the propoprty ListView1.View = View.LargeIcon
hope this helps you..
Khalid
|
|
|
|
|
Hi all
I need a function that coverts first letter of each word in a string to uppercase.
Thanks in advance
|
|
|
|
|
|
(1) Separate Words (hint: use Regex ).
(2) Capitalize the first letter of each found word (Char.ToUpper method maybe handy)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Use StrConv - e.g.
StrConv("yikes a vb function from old vb", VbStrConv.ProperCase)
|
|
|
|
|
I want to built a software in vb.net. We keep the recent updates(latest version). The software can check for recent updates, if there was any recent update the customer gets download link. When customer click on link, the software download the updated files within the application, kind the way Microsoft updates work.
Please help me, how can i built.
raj
|
|
|
|
|
I am not sure how exactly you could code this, but here is an idea.
1) Have a specific url that the program checks for latest updates. Possibly use an XML file to store a list of updates and links to their locations, or a script of some sort that looks at the current product version and suggest updates accordingly.
2) Through a plugin system (possibly in an update directory) you could store the downloads, and when the program starts up you could just have the program look for the latest update.
3) Keep track of which features will be installed or available to the user through the registry.
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 homepage Oracle Studios[ ^]
|
|
|
|
|
Hi all,
I am doing a utility about checking network. I want to set a timeout for it. I mean that if timeout = t, after that time the function of checking network will be stopped. I tried with the Timer control but it failed. I am thinking about multithreading...
Can you help me. Thank you in advanced.
Thanh )
|
|
|
|
|
That depends on how you are "checking the network". So what are you doing and what's the code look like that you're using to do this?
|
|
|
|
|
hi
to all
i am using sqlbase as backend.
i want to develop a webform
i have a textbox , button, and a datagrid in it
in datagrid i have a template column in which i have kept a image control in the itemplate.
i have created a table called movies in my database.
it has mid,mname and murl as columns
mid has a id,
mname has the movie name,
murl consists of the url's of the mname's.
now when type in the mname in the text box. i am gettin the mid and mname in the grid columns. bu not the pics. how to retrieve them.
my code is something like this
coding
---------
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Dim dsOB As New DataSet
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sConnect As String = "provider=SQLBASEOLEDB.1;Persist Security Info=False;User ID=SYSADM;Data Source=LOGIN;Password= HYPER"
Dim dr As DataRow
Dim con As New OleDbConnection
Dim cmd As New OleDbCommand
con.ConnectionString = sConnect
cmd.Connection = con
con.Open()
Dim sSelectOB As String = "select mid,mname from movies where mname like '%" & TextBox1.Text & "%' "
Dim daOB As New OleDbDataAdapter(sSelectOB, sConnect)
'Dim dsOB As New DataSet
daOB.Fill(dsOB,"movies")
Dim str As String
'TextBox1.Text = dsOB.Tables(0).Rows(0).Item(2)
'gridbind()
'Image1.ImageUrl = dsOB.Tables(0).Rows(0).Item(2)
'Image1.ImageUrl =
' bind()
DataGrid1.DataSource = dsOB
DataGrid1.BackImageUrl = dsOB.Tables(0).Rows(0).Item(1)
DataGrid1.DataBind()
'DataGrid1.Items.Item(2)
'DataGrid1.DataKeys.Item(2)
'Response.Pics(dsOB.Tables(0).Rows(0).Item(2))
'Image1.Visible = True
con.Close()
End Sub
Sub bind()
End Sub
Private Sub DataGrid1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.SelectedIndexChanged
'If sender = dsOB.Tables(0).Rows(0).Item(2) Then
' e.Item.Cells(0).Controls(1).Visible = True
'End If
End Sub
Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.EditCommand
End Sub
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
Dim image1 As System.Web.UI.WebControls.Image
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
image1 = CType(e.Item.Cells(0).Controls(1), System.Web.UI.WebControls.Image)
image1.ImageUrl = e.Item.Cells(0).Text
End If
End Sub
End Class
i know that this code is incomplete.
but i will be glad if any one can help mew out in this.
thanks in advance
No End No Begining
|
|
|
|
|
Hi all i have this code, and i want to pass parameters to the function
being executed by the thread
Dim t1 As Thread = New Thread(AddressOf execute)
Dim t2 As Thread = New Thread(AddressOf execute)
t1.Start(1)
t2.Start(1)
sub execute(ByVal num as integer)
''Statements
''
end sub
Regards
|
|
|
|
|
The parameter is sent as the type Object.
Sub execute(num as Object)
---
single minded; short sighted; long gone;
|
|
|
|
|
Thanks a Lot it did work.
I have another question how can i keep a thread wait untill the other one finishes. Say i have
Dim t1 As Thread = New Thread(AddressOf execute)
Dim t2 As Thread = New Thread(AddressOf execute)
t1.start(0)
t2.start(1)
But t2 should not start untill t1 finishes. I have to create say varying threads right now i and only creating two threads but i have to actually create as many as there are records in the database. but at the same they won't be more then 5, but could be less even one. At end of the program(thread) i am updating records in the database and that is the reason i dont want to start the next thread before the finish of the first.
Regards
|
|
|
|