|
After finally getting somewhere with reading XML, I ran into a problem. I want to list all the feed titles in a listview, and then when I click on a title, I want to view the the "Description" tag corresponding to the selected item. What I am having trouble with is determining which item I have clicked so that I can display the corresponding description. Here is what I have now:
Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged
Dim XMLDoc As XmlDocument
Dim NodeListTitle As XmlNodeList
Dim NodeListText As XmlNodeList
Dim XmlDocNode As XmlNode
XMLDoc = New XmlDocument()
XMLDoc.Load("C:\feed.xml")
NodeListTitle = XMLDoc.SelectNodes("/rss/channel/item/title")
NodeListText = XMLDoc.SelectNodes("/rss/channel/item/description")
'Determine what item is selected and display it's description
For Each XmlDocNode In NodeListText
PostBox.Text = XmlDocNode.InnerText
Next
End Sub
How should I go about getting the selected item and determining it's description tag? And is this the proper way to read an XML file? Thanks for the help!
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
hi there,
i have a problem with following coding. it is a coding of saving text file. and its saving the text file but when the file open in notepad then the all the lines merge together
eg. write 4 lines in textbox
12343
1232
222435
4343
and save
when open in notepad ,it look like this image
http://img213.imageshack.us/my.php?image=errorka4.jpg[^]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fName As String
Save.ShowDialog()
fName = Save.FileName
If Save.FileName <> "" Then
Dim fSave As New StreamWriter(fName)
fSave.WriteLine(Text1.Text)
fSave.Flush()
fSave.Close()
End If
End Sub
someone know what is the cause of it?
|
|
|
|
|
|
|
How to calculate time difference in hours between two dates, let's say 01/01/01 12:00 and 02/02/07 7:00?
|
|
|
|
|
Just use the DateTime.Subtract function, like so:
Dim FirstDate As New DateTime(2007, 2, 2, 7, 0, 0)
Dim SecondDate As New DateTime(2001, 1, 1, 12, 0, 0)
Dim FinalDate As TimeSpan = FirstDate.Subtract(BDayNow)
Hope this helps!
Trinity: Neo... nobody has ever done this before.
Neo: That's why it's going to work.
|
|
|
|
|
You can subtract DateTime values, the result is a TimeSpan. You can use the TotalHours property to get the time difference. Example:
Dim startTime as DateTime = new DateTime(1, 1, 1, 12, 0, 0)<br />
Dim endTime as DateTime = new DateTime(7, 2, 2, 7, 0, 0)<br />
Dim diff as TimeSpan = endTime - startTime<br />
Dim hours as Double = diff.TotalHours;
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi there,
You can use the 'DateDiff' function, realy easy to work with.
Regards, Werries
A programmer's life is good... or is it?? Ek dink nie so nie!
|
|
|
|
|
I heard on this forum that .NET 2.0 has an integrated capability to compress folders to zip file. How to use this and what is the syntax? Can you give me an example code? I would like to compress two folders "C:\temp" and "D:\foo" into a single zip-file that would be saved into "E:\zipfiles".
|
|
|
|
|
|
Hi,
I have two forms say Default.aspx and popup.aspx
Default.aspx cotains a textbox whereas popup.aspx contains a text area.
When user enters more than 10 characters in a textbox of default.aspx,popup.aspx should open and all characters of text box should get transfer to textarea of popup.aspx.
The code that i had written using javascript is as follows:
function limitText(){
var textboxvalue = document.getElementById("limitedtext").value;
if(textboxvalue.length == 10)
{
alert(textboxvalue);
window.open("popup.aspx?value=textboxvalue","","resizable=1,width=600,height=200")
}
}
And This is textbox code:
******Retrieving value in popup.aspx********
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim strQuery As String = ""
strQuery = Request.QueryString("value").ToString()
TextArea1.Value = strQuery
End Sub
But When i put break point and check the value of strQuery, it is showing
"textboxvalue" instead of characters typed in the textbox.
I will be very grateful if you tell me that how should i pass the value through the url from the line:
window.open("popup.aspx?value=textboxvalue","","resizable=1,width=600,height=200")
Thanks
Shyam (new to javascript)
|
|
|
|
|
This is an ASP.NET question.
Pass the data on the URL.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I want to buy vb6.0. Where can I find the cheapest and fast deal for it.
ciacia
|
|
|
|
|
The only place you're going to find VB6 is on eBay. VB6 hasn't been available for purchase retail for about 5 years now.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Can anyone tell me what is the syntex to open a HTML file in my documents? (\My Documents\123.html)
When I click on the button, I want the HTML file appear.
What's wrong with the coding below?
Dim sr As StreamReader = New StreamReader("\My Documents\123.html")
Dim line As String
Do
line = sr.ReadLine()
Console.WriteLine(line)
Loop Until line Is Nothing
sr.Close()
Thanks for your help!
|
|
|
|
|
The main problem you would have here, is that you don't have a proper path to the file. You can use Environment.SpecialFolder to get the path to the current MyDocuments folder.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I don't think so because the html file is located at My Documents.
May I know how to use Environment.SpecialFolder?
Thanks for your reply!
|
|
|
|
|
crazyteh wrote: I don't think so because the html file is located at My Documents.
My Documents maps into the users profile, like this:
C:\Documents and Settings\<userid>\My Documents
crazyteh wrote: May I know how to use Environment.SpecialFolder?
Sure, all you have to do is read the documentation[^] on it. It's very easy.
Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic 2006, 2007
|
|
|
|
|
Like Dave said. I'll just add, if you want to be a developer, when someone tells you to use something you don't know about, try typing it into google before you ask.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I would like to acheve that when the user clicks on save form or tries to close the form,
the code would check if chkbox_otp is checked and if it is not checked than would show a msg to the user, that they must select a town from the combobox(listbox).
THANKS!!!
|
|
|
|
|
The form has a FormClosing event
Sub Form1_FormClosing(byval sender as Object, byval e as System.Windows.Forms.FormClosingEventArgs)
You can check here for your condition, if it doesn't meet your check
there are two parameters passed to this procedure.
Use the e FormClosingEventArgs
e.CancelReason="You Need to check that"
e.Cancel=True
Hope this helps.
~ CodeDoctor ~
|
|
|
|
|
Hi CodeDoctor!
Thank you for your reply.
When I click on the form I see:
Option Expilict. Below that: Privat Sub lblRefer_Click()
End Sub
Privat Sub Command1_Click()
End Sub
I have found this:
Privat Sub Form_Unload(Cancel As Integer)
---Should I put your code here maybe?---
End Sub
I don't have a Sub Form1.
I'm sorry, I am a beginner.Thanks So much!!
|
|
|
|
|
try this. Instead the code is in the Form_Load try to change it to Form_Closing.
here is the code:
if the user press the close, a message will appear.
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
dim ans
ans= MsgBox("Close this form?", MsgBoxStyle.YesNo, "Close")
if ans=MsgboxResult.Yes then
me.Close
endif
End Sub
Don't block the drive way of all the newbies in programming. )
|
|
|
|
|
hi
i have an xml file and i populated that in a treeview control.what i want is - modify the treeview like add nodes,delete nodes or edit etc and write back to the xml file/ create an xml file from that modified treeview control using vb.net
diees
|
|
|
|
|
I'm trying to read a sequential/random file written by a QBasic program, and one of the fields in the file is defined as 'Double Precision'. The field appears to be 8 bytes in length, but does not map appropriately to VB.Net 2005's Double or Long datatypes. After executing a FileGet, the double precision variable, (OrderAmount), is always filled with the wrong number.
I'm reading the record using the following logic:
Private Structure myRecordStructure
<vbfixedstring(10)> Dim FirstName As String
<vbfixedstring(15)> Dim LastName As String
<vbfixedstring(15)> Dim StreetAddress As String
<vbfixedstring(6)> Dim OrderDate As String 'MMDDYY
Dim DaysDue As Short
Dim OrderAmount As Double
End Structure
Private myRecord As myRecordStructure
mintFileNumber = FreeFile()
mstrFileName = "c:\control1.f"
FileOpen(mintFileNumber, mstrFileName, OpenMode.Random, _
OpenAccess.Read, OpenShare.Shared, Len(myRecord)
FileGet(mintFileNumber, myRecord)
Any help towards converting the QBasic double precision data to values that can be viewed from within VB.Net 2005 will be greatly appreciated.
Thanks
G-3
|
|
|
|