|
Hi guys, how can i know if two PC are in the same lan??
Please help me
|
|
|
|
|
Cosby wrote: Hi guys, how can i know if two PC are in the same lan??
Do you really want to verify whether they're in the same network, or do you want to know whether the other PC is accessible over the network?
If the last is the case, then use the Ping [^] class.I are Troll
|
|
|
|
|
I want verify if they're in the same lan not if a pc is accessible over lan!
|
|
|
|
|
Hi guys, I would like know how can i check if PC have WOL support and if it is enable or not (in vb or c#).
Somebody can help me??
Thank you men
|
|
|
|
|
write know i am gettin null reference exception due to followin code
Imports System.Xml
Imports System.IO
Public Class TreeView
Dim xNode As XmlNode
Private Sub btnOpenXml_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenXml.Click
populateTreeview()
End Sub
Private Function SelectTextFile() As String
Dim fDialog As New OpenFileDialog()
fDialog.Filter = "xml files (*.xml)|*.xml"
fDialog.InitialDirectory = "~\Desktop"
Return If((fDialog.ShowDialog() = DialogResult.OK), fDialog.FileName, Nothing)
End Function
Private Sub populateTreeview()
Try
'Just a good practice -- change the cursor to a
'wait cursor while the nodes populate
Me.Cursor = Cursors.WaitCursor
'First, we'll load the Xml document
Dim xDoc As New XmlDocument()
xDoc.Load(SelectTextFile())
'Now, clear out the treeview,
'and add the first (root) node
tvXmlTree.Nodes.Clear()
tvXmlTree.Nodes.Add(New TreeNode(xDoc.DocumentElement.Name))
Dim tNode As New TreeNode()
tNode = DirectCast(tvXmlTree.Nodes(0), TreeNode)
'We make a call to addTreeNode,
'where we'll add all of our nodes
addTreeNode(xDoc.DocumentElement, tNode)
'Expand the treeview to show all nodes
tvXmlTree.CollapseAll()
Catch xExc As XmlException
'Exception is thrown is there is an error in the Xml
MessageBox.Show(xExc.Message)
Catch ex As Exception
'General exception
MessageBox.Show(ex.Message)
Finally
'Change the cursor back
Me.Cursor = Cursors.[Default]
End Try
End Sub
Private Sub addTreeNode(ByVal xmlNode As XmlNode, ByVal treeNode As TreeNode)
Dim tNode As TreeNode
Dim xNodeList As XmlNodeList
If xmlNode.HasChildNodes Then
'The current node has children
xNodeList = xmlNode.ChildNodes
For x As Integer = 0 To xNodeList.Count - 1
'Loop through the child nodes
xNode = xmlNode.ChildNodes(x)
treeNode.Nodes.Add(New TreeNode(xNode.Name))
tNode = treeNode.Nodes(x)
addTreeNode(xNode, tNode)
Next
Else
'No children, so add the outer xml (trimming off whitespace)
'treeNode.Text = xmlNode.OuterXml.Trim()
' treeNode.Text = xmlNode.LocalName.Trim()
End If
End Sub
Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
tvXmlTree.Refresh()
End Sub
Private Sub tvXmlTree_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvXmlTree.AfterSelect
'xNode = DirectCast(tvXmlTree.SelectedNode.Tag, XmlNode)
'Me.txtContent.Text = xNode.InnerXml
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub btnDeleteNode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeleteNode.Click
tvXmlTree.SelectedNode.Remove()
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
txtContent.Text = String.Empty
txtXml.Text = String.Empty
End Sub
End Class
the above is my code
in this block i am getting object null reference exception
Private Sub tvXmlTree_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvXmlTree.AfterSelect
'xNode = DirectCast(tvXmlTree.SelectedNode.Tag, XmlNode)
'Me.txtContent.Text = xNode.InnerXml
End Sub
i am unable to figure out.can anybody share u r views regarding this issue hw to clarify this
Thanks & Regards
SANDEEP ADEMhi
|
|
|
|
|
1. Format the code using "pre" tags.
2. Don't post entire code. Just post the relevant parts.
3. Something is null in your code while you try to use it. Debug and check."No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
|
|
|
|
|
sorry here is the code
Private Sub tvXmlTree_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvXmlTree.AfterSelect
xNode = DirectCast(tvXmlTree.SelectedNode.Tag, XmlNode)
Me.txtContent.Text = xNode.InnerXml
End Sub
here i am using treeview control i had to get the xml from node node selected i am getting null reference exception at the
innerxml
Thanks and regards
SANDEEP ADEMhi
|
|
|
|
|
If that cast is working properly and XmlNode is getting created properly. "No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
|
|
|
|
|
I don't see anywhere in your code where you set the Tag to anything...then you try to cast the Tag into an XmlNode . That's your problem.
|
|
|
|
|
yes what u r saying is exactly right hi
|
|
|
|
|
You should also check tvXmlTree.SelectedNode to make sure something is selected. If you deselect a node then this event will fire and your code will fail.
|
|
|
|
|
How exactly are you deselecting a node? In a TreeView , you can't click on an object to deselect it. And, if you set
TreeView1.SelectionNode = Nothing
then, After_Select doesn't get called. Show me example code that will fire After_Select on a deselect.
|
|
|
|
|
Sorry, I didn't verify that. I thought that was the case but I suppose that is left over from working on an Access application . Which I know behaves that way. However, I do try to check all variables before using them, even when they are "guaranteed" to be instantiated.
|
|
|
|
|
I gotta say, this is badly written. First, why would you put an entire sub within a Try /Catch block? If you want the old VB6 On Error , you can still use it...though it's not suggested.
Only put the sections of code that you think could throw an exception within the Try /Catch . That's what it's there for.
Private Sub populateTreeview()
Try
*
*
* Me.Cursor = Cursors.WaitCursor
*
* Dim xDoc As New XmlDocument()
xDoc.Load(SelectTextFile())
*
*
* tvXmlTree.Nodes.Clear()
tvXmlTree.Nodes.Add(New TreeNode(xDoc.DocumentElement.Name))
* Dim tNode As New TreeNode()
* tNode = DirectCast(tvXmlTree.Nodes(0), TreeNode)
*
*
* addTreeNode(xDoc.DocumentElement, tNode)
*
* tvXmlTree.CollapseAll()
Catch xExc As XmlException
MessageBox.Show(xExc.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
Me.Cursor = Cursors.[Default]
End Try
End Sub
I've put asterisks besides the lines of code that should never throw an exception. So, there are only two lines that could possible throw an error...if the SelectFile() doesn't return a valid item for the xDoc.Load and if xDoc.DocumentElement doesn't exist, though if it doesn't it means that the xDoc.Load didn't work which should have already thrown an exception.
And, by the way,
DirectCast(tvXmlTree.Nodes(0), TreeNode)
in this line, all TreeView Nodes are TreeNodes . You don't need to DirectCast them.
|
|
|
|
|
Hello,
I would like to ask how can I to filter between certain range of date
and display it in my datagridview.
Below here is my sample code that I have tried but not yet working
adodc1.RecordSource = "SELECT * FROM studRecords where dateEnrolled _
BETWEEN DTPicker2.Value AND DTPicker1.value"
adodc1.Refresh
Any comments or suggestions are kindly appreciated
Thanks,
dfan23
|
|
|
|
|
If Database is Access
adodc1.RecordSource = "SELECT * FROM studRecords where dateEnrolled _
BETWEEN #" + DTPicker2.Value + "# AND #" + DTPicker1.value + "#" else If Database is SQL
adodc1.RecordSource = "SELECT * FROM studRecords where dateEnrolled _
BETWEEN '" + DTPicker2.Value + "' AND '" + DTPicker1.value + "'"
|
|
|
|
|
Hello,
Can I ask a follow up question if how do I will put the sql query of the between command so that the filter data will be only shown in the crystal report I will be creating.Like showing only the filter data into crystal report
Thanks,dfan23
|
|
|
|
|
Use selection formula in crystal report, that's all.
|
|
|
|
|
check the Date formats Best Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
We have a legacy Visual Basic application. It references a third party .Net DLL and that requires few keys to be set in the application's APP.Config. That DLL reads those keys from the APP.Config.
Not sure how to create APP.Config and add those keys. Any help is greatly appreciated.
Thanks,.RamDili
|
|
|
|
|
VB6 doesn't use app.config files, so I have no idea if this ies even going to work.
You'll have to put whatever information is required into a file that has the same name as your app's .EXE filename, with ".config" appended to the end of it. For example, if your applications .EXE has a filename of MyApplication.exe , then the app.config filename would be MyApplication.exe.config and would be in the same folder as the .EXE.
|
|
|
|
|
app.config is XML file , in vb6 you can Read /Write to XML. try using DOM Best Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
Hi friends,
I was create a project in vb6. this project purpose is integrate excel. now am converted in vb 2008. it working fine but form could not visible form status, after load excel this will show while working i could not view the form. how can i solve this problem. help me...
|
|
|
|
|
Hi, I realise that English is not your first language and I am having difficulty understanding what you are trying to say without any code samples to back up your request.
May I suggest that if there is a Google translation facility for your language that you write your request again in your own tongue and have Google translate? Most of Googles translations are not too bad.
|
|
|
|
|
Since you are in the United States you may want to find a friend who is good at English to help you rephase your question.
|
|
|
|