|
jayachandra.c wrote: here just i want to know how to get the Internet connection Status in VB6 whether it is working/not working.
The most used way would be using InternetGetConnectedState API. An example can be found here[^].
Alternatively, you could launch the Ping command and capture it's output. If you can Ping Google, you're online I are Troll
|
|
|
|
|
I would say that is not necessarily true. It depends on what you mean by 'working'. You could be connected but have DNS issues that would prevent a successful ping. I only say that because I did have DNS issues and ran into this often.
|
|
|
|
|
Dear All,
I have issue with the exhadecimal.
I want to convert it to text by VB.net and FoxPro 6.0.
But i do not know any thing about it.
Do you have any idea or solving of this problem ?
Thanks for your help...VB.Net
|
|
|
|
|
Golden Jing wrote: I have issue with the exhadecimal.
I want to convert it to text
The hexadecimal "&hFF" would have a tekstual representation that equals "FF".
Console.WriteLine(Convert.ToInt32("FF", 16)) The above example converts the value "FF" to a decimal value, which should be 255 for "FF".I are Troll
|
|
|
|
|
|
Dear Eddy,
Thanks for you help.
But now my problem now is that the hexadecimal is so long.
mean that it is sentent so i want to convert that to the text.
have any solving of that ?VB.Net
|
|
|
|
|
Golden Jing wrote: But now my problem now is that the hexadecimal is so long.
How long? 10 characters, 50 characters?
A hexadecimal number is alread 'shorter' then a decimal number (compare "255" to "FF"). One way to make the resulting string smaller would be by compressing[^] it.I are Troll
|
|
|
|
|
ohh it is not sure.
it is up to sentense.
so i cannot know how long it is.VB.Net
|
|
|
|
|
I'm trying to figure out how to transfer files from a PPC to a PC, however I'm trying to do this from a PPC application, not from a desktop app. I looked into using the OpenNETCF framework, but the file transfer methods through RAPI only work for desktop apps, and I can't find anything else that would seem to work in the OpenNETCF framework or the .NET CF. Basically in the PPC app the user would select a group of files that would be transfered to a predetermined folder on the PC. If the folder does not exist on the PC then it would be created and the files transfered. Anyone have any idea how this could be accomplished? Thanks in advanced.
|
|
|
|
|
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 + "'"
|
|
|
|