|
El segundo código es mas eficiente y rapido.
_______________________
Edward J. Ocando. | Desarrollador | SoyDesarrollador.net
Telefono. +58 (416) 164.34.88 | Edward.Ocando@soydesarrollador.net
|
|
|
|
|
I'm having a problem I can't seem to find the source of in a program I'm developing. The following function parses an XML file to find the names of registry keys and associated values that are linked to the selection of a drop-down box in the UI. The function retrieves keys with no problem. when asking for the values, it always returns 0, and I can't seem to figure out why. Thanks for taking a look and any suggestions/solutions you may come up with.
I've included the source of the function below and a sample of the XML -
Public Function GetCfgOption(ByVal strSetting As String, ByVal intSelectedIndex As Integer, ByVal strDataType As String, Optional ByVal intOptIndex As Integer = 0) As String
Dim xmlSettings As New Xml.XmlDocument
xmlSettings.Load("SrcBench.xml")
Dim nodeSetting As Xml.XmlNode
nodeSetting = xmlSettings.SelectSingleNode("/CONTENT/Settings/" & strSetting & "[Index='" & intSelectedIndex & "']")
Dim nodeOption As Xml.XmlNode
nodeOption = nodeSetting.SelectSingleNode("/CONTENT/Settings/" & strSetting & "/Setting[@Index='" & intOptIndex & "']")
Select Case strDataType
Case "Key"
Return nodeOption.ChildNodes.Item(0).InnerText
Case "Value"
Return nodeOption.ChildNodes.Item(1).InnerText
End Select
Return Nothing
End Function
This function would be called like so:
GetCfgOption("FilterMode", intFilterModeIndex, "Key"<, 0>)
GetCfgOption("FilterMode", intFilterModeIndex, "Value"<, 0>)
GetCfgOption("FilterMode", intFilterModeIndex, "Key", 1)
GetCfgOption("FilterMode", intFilterModeIndex, "Value", 1)
This could be tested using a Console.WriteLine() statement. Calling the function with "Value" always returns "0".
The following is a section of the XML file being accessed:
="1.0"="UTF-8"
<CONTENT>
<Settings>
<FilterMode>
<Index>0</Index>
<Option>Bilinear</Option>
<Setting Index="0">
<Key>mat_forceaniso</Key>
<Value>0</Value>
</Setting>
<Setting Index="1">
<Key>mat_trilinear</Key>
<Value>0</Value>
</Setting>
</FilterMode>
<FilterMode>
<Index>1</Index>
<Option>Trilinear</Option>
<Setting Index="0">
<Key>mat_forceaniso</Key>
<Value>1</Value>
</Setting>
<Setting Index="1">
<Key>mat_trilinear</Key>
<Value>1</Value>
</Setting>
</FilterMode>
<FilterMode>
<Index>2</Index>
<Option>2x Anisotropic</Option>
<Setting Index="0">
<Key>mat_forceaniso</Key>
<Value>2</Value>
</Setting>
<Setting Index="1">
<Key>mat_trilinear</Key>
<Value>0</Value>
</Setting>
</FilterMode>
<FilterMode>
<Index>3</Index>
<Option>4x Anisotropic</Option>
<Setting Index="0">
<Key>mat_forceaniso</Key>
<Value>4</Value>
</Setting>
<Setting Index="1">
<Key>mat_trilinear</Key>
<Value>0</Value>
</Setting>
</FilterMode>
<FilterMode>
<Index>4</Index>
<Option>8x Anisotropic</Option>
<Setting Index="0">
<Key>mat_forceaniso</Key>
<Value>8</Value>
</Setting>
<Setting Index="1">
<Key>mat_trilinear</Key>
<Value>0</Value>
</Setting>
</FilterMode>
<FilterMode>
<Index>5</Index>
<Option>16x Anisotropic</Option>
<Setting Index="0">
<Key>mat_forceaniso</Key>
<Value>16</Value>
</Setting>
<Setting Index="1">
<Key>mat_trilinear</Key>
<Value>0</Value>
</Setting>
</FilterMode>
</Settings>
</CONTENT>
|
|
|
|
|
How can I design web user account and login using Visual basic 8
|
|
|
|
|
|
I have to design a form with LISTBOX,FIELD to display name,CAPITAL CITY and estimeted population of selected country.
Pleas just give me a clue or enlightment!
|
|
|
|
|
So....what part of your homework assignment are you having problems with??
If you don't know how to drag and drop controls on a form in Visual Studio you've got a serious problem that we can't fix.
|
|
|
|
|
How to code the month control or datetimepicker to have month. I don't want to have 2 datetimepicker. Is there a way for user to only choose month then display that months data from 1st to 31st for example?
I have no idea how to do because each month has different days.
|
|
|
|
|
Get the month and year from the user then use the DateTime.DaysInMonth method to get the number of days in that month.
When you have those two things, you can make two DateTime objects using the month and year supplied by the user. Use the 1st of the month to start the date range and the number of days returned by DaysInMonth to create the second date value.
There's your date range. You just supply those two dates to a couple of parameters in your SQL query (PLEASE USE PARAMETERIZED QUERIES AND NOT STRING CONCATINATION!!) to retrieve the data.
If you don't know what a parameterized query is, Google for "VB.NET SQL Parameterized Query".
|
|
|
|
|
Thank you, I might ask too much.....can you provide me some examples or links because I am still new to this.
|
|
|
|
|
|
Okay thank you very much.
|
|
|
|
|
i am doing a project which will display real time ecg on vb application.
i just wanted to know that.. is there any way that we can display ecg in vb6? How?
|
|
|
|
|
VB6 is deprecated, meaning that it's no longer actively supported. If you're going to write new software, use VB.NET.
Can you give me a good reason why this "needs" to be in VB6?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Dear friends,
i have been trying to get report in visual studio 2010 by passing parameters such as startDate, endDate and etc.
but i haven't done it yet
Can someone help me to generate this report by using report viewer .
preferred Language = vb.net
|
|
|
|
|
Hello all,
I want to try and do something that I think should be fairly easy, but I could be wrong. I want to have an icon in the system tray and it would change colors and blink depending on the system status.
Green - All systems are up and running
Red - There is a system down.
Yellow - Scheduled outage for today.
Orange - You are not connected to the network.
Ia m not sure how to even get started. I have written code, but not a lot of VB more VBA, ASP, Javascript. Would I create a service for this. I was thinking about having the icon check for a file.
So if the file is called Green.txt The icon would be green and if the user hovered over the icon or clicked on it the contents of the text file would be in the balloon or a message box could display the contents.
For Orange I was just going to ping a DC and if it did not get a reply then I know they are not connected to the network.
I have searched for hours to find something but I cannot seem to find anything.
TIA,
Rodger
|
|
|
|
|
You can't do this in a service. Here is an article that will show you how to create an application like you describe., Create a System Tray Application in VB.NET[^]
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Thank you for the article. I was able to edit the code to look for the file. I have a question do you know how I can have it check every 5 minutes for the file so I can change the icon and message when we have an outage?
|
|
|
|
|
RodgerDJr wrote: check every 5 minutes for the file
Use a timer.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
OK I am really new at VB so I need a little push . . . where would I add the timer, do I put that in the main section to call itself?
|
|
|
|
|
RodgerDJr wrote: where would I add the timer
You add the timer where ever it is that you want to use it.
RodgerDJr wrote: main section to call itself
Not sure what you mean by that. You instantiate the timer with an interval that you want the timer to fire, create an event for the timer to call when the interval expires and do whatever it is that you want to do in the event. http://msdn.microsoft.com/en-us/library/system.timers.timer.aspx[^]
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
OK I am going to go try this. Thanks!
|
|
|
|
|
You're welcome
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
is there anything that can give me an example of encryption program with vb.net?
|
|
|
|
|
Plenty of examples to choose from[^]
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Yes, it's called "a programmer".
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|