How To Reconfigure Code To Output Specific Values Rather Than Collection
Aug 26, 2011How to reconfigure code to output specific values rather than collection
View 2 RepliesHow to reconfigure code to output specific values rather than collection
View 2 RepliesI currently this code on my app that works great to loop through a page and grab the label of an input value of a form and then print the value to a rich text box.I am now trying to revamp the code to give me the ID the value if the label contains a specific name.For instance if the label before the input field contains the word Username then I want the application to output the ID of the input field rather than just everything that has a label.
Here is my current code:
Dim web As HtmlAgilityPack.HtmlWeb = New HtmlWeb()
Dim doc As HtmlAgilityPack.HtmlDocument = web.Load("http://shaggybevo.com/board/register.php")
Dim nodes As HtmlNodeCollection
[code]....
Input a range of numbers and sort them into 6 equal amounts and then having the program tell you which amount the number was put into?
I.e
Input:
1200, 2400, 600, 600, 300, 300, 1200, 1200
Sorted into:
Group A: 2400 = 2400
Group B: 1200 + 1200 = 2400
Group C: 600 + 600 + 300 + 300 + 1200 = 2400
Normal
0
false
[Code]....
This question has been most likely been asked a number of times, but really hitting a brick wall regarding this.
The issue is that at the moment, I have to create a database using text files on VB.
So far I have managed to get the code working to add new customer and browse added records, but stuck on how to output/input back and fore to a text file, to store information, and after this input/output the text file to a DB ( Not worried about this at the moment)
Public Class Customer
Dim CmrColl As New Collection 'Create the new collection. Think of this as an array of objects.
Dim itemCount As Integer = 0 'A variable to help us scroll through the objects later.
[Code].....
I added some fields to a table in my Access database which is the dataset in my VB.NET 2008 project. So now I'm going to have to re-configure the dataset. (Data/Show data sources/configure dataset with Wizard - at least that's the way I know to do it). Will this wipe out the exixting queries in my table adapters? Even on tables that have not been changed? If so, is there any way to avoid this?
View 1 RepliesI'm just going to throw all my code in here in case there's something wrong with a piece of the code not in the "SelectName()" sub.
Module Module1
Dim selectednames As String = ""
Dim index As Short = 0
Dim inarray As Boolean = False
[code]....
Here's an image of what it does (I suppose you can see what went wrong)13 inputs, 3 outputs expected, only 1 output given.As from what I've figured out so far, it's doing the correct amount of loops etc. It's just as soon as it starts generating the "winner" for the 2nd game key it doesn't get a string value from namesarray.Also, why is
For x = 0 To totalnames - 1
Debug.Print("namesarray(" & x & ") = " & namesarray(x))
Next
not giving me a debug output?
I am using the following function to return the twitter ID and ScreenName. I need to output this data in the following XML format and then save it to a .xml file.
[Code]...
I am using VS 2010 to make a web site and working on a page right now. After submitting my variables, I need to output the values as a pdf
View 1 Repliesuse values to output and save as pdf
View 4 Repliesi have a string = "/a/value1/x/valueforx/b/value2/c/value3"
the keys a, b, and c can be in any order in the string that is coming in and will always be separated by a slash.
What i need to do is to find a, b, c and then add their values to a collection
how to plot a graph using the out put values in textbox[code].....
this is my code but it doesnt seem to accept the output. It works everytime I enter number only.
I am creating an instance of a Generic List collection and I am surprised to find that I can't add more than one value to it at a time. I was thinking there was going to be something like what you can do with arrays, where you can add a group of values to it at creation. I saw the AddRange method, but that seems to add another collection to the end of this collection, which is not what I want. So my code is:
vb
Dim MyList as New List(Of String)
MyList.Add("John")
MyList.Add("Bob")
[Code].....
Is there a way to to combine line's 1 and 2? I only want to loop through a list of the selected items in this listbox. This works just fine, I just wondered if there was a collection of selected values returned that I could use to avoid having to do it this way.
For Loop1 = 0 To MyListBox.Items.Count - 1
If MyListBox.Items(Loop1).Selected = True Then
...
End
Next
Ok, letīs see, iīm kind of new to this so letīs see if you can follow...I have a IEnumerable list of objects:
Dim
objStudentUsers
As
[code].....
i am having trouble displaying the values i get from an IList(Of T) and displaying that in a listbox found on another form. I have used a for loop to get the values from the IList, then i can display that in a msgbox. for eg:
Dim j As Integer
Dim path As String = ""
For j = 0 To best_tour.Count - 1
[code]....
best_tour is ot type IList() path keeps the name found in the list everything works fine inside the loop..but it does not populate the lst_output listbox.I have tried using files, but in vain. It just get the values from the list but does not display that on the listbox.If that can help, then listbox is found in a panel on the form2, but taking it out of the panel does not affect anything.
I wrote this code and everything works as planned:
Module SalesCommissionProgram
Sub Main()
Dim name As String = 0
Dim code As String = 0
Dim monthlySales, commissionDollars As Double
' Prompt user to input value for name
[Code] .....
For the finished project I am supposed to have it output the total sales and commissions for that were calculated before the sentinel value (Eugene) was entered. Here is what I tried and here is where I am lost.
Module SalesCommissionProgram
Sub Main()
Dim name As String = 0
Dim code As String = 0
Dim monthlySales, commissionDollars As Double
[Code] .....
I've been building a simple card game in VB using VB 2010 express. I've built a simple Card class, as follows:
Public Class Card
Public Property Number As Integer
Public Property Suit As String
Public Property Image As String
End Class
I setup a base deck to create the unique, individual cards, which will then be used in multi-deck games. I have a game table form where the cards will be displayed. I declared this base deck inside the game table form and built it during the form's load event:
Public Class Main_Table
Public baseDeck As List(Of Card) = New List(Of Card)
Private Sub Main_Table_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myCard As Card = New Card()
[Code] .....
Everything runs fine up until the end of Main_Table_Load. I've inspected the baseDeck values and they are correct. But when the Build_Deck_Click sub is invoked, the baseDeck collection's values become all the same, specifically it becomes composed of copies of the last card I built. I've stepped through the code and expanded baseDeck to confirm that all Cards become the same. I've tried moving the Public baseDeck As List(Of Card) = New List(Of Card) to a different module, with the same results. Since I will be using the baseDeck list through the app, I can't declare it privately inside the form_load event, as I'd have to re-create it every time I need to use it.
I am working on my first VB application and have run into a problem. I am trying to loop through some data and displaying them in labels. I am using a for-each loop but end up with different row with the same labelname. What I would like to do, is to assign a number to the labelname (mylabel1, mylabel2,...), but I canīt figure out how, and I cant find anything online that will work. Here are some of the code that I have made, where I could use a solution to my problem...
[Code]...
"Working with Multiple Forms in Visual Basic .NET: Upgrading to .NET" url...states very clearly, "you need an instance of a form before you can display it or work with any of its controls or properties". Granted, this was written for VB.NET 2003, but I can't find any reference where this has been changed in later versions. [code] Running this in Debug, both OriginalForm and InstantiatedCopy work fine. The Output window displays the values for both forms identically. (I'm using Visual Studio Professional 2010.)
View 17 RepliesJust sorting a value and displaying them with original values. Procedure is displaying the sorted values in msgbox but in place of the original values, it displays the original values again.
Public Sub FlagProb2()
Dim Count() As Integer = {2, 1, 4, 3} 'Original Array
Dim SortedCount() As Integer = Count 'New array for sorted values of original array
Array.Sort(SortedCount) 'Sorting values
For j As Integer = 0 To Count.GetUpperBound(0)
MsgBox(SortedCount(j) & " , " & Count(j)) ' Displaying sorted and unsorted values
Next
End Sub
I am working on this project in .net. When you go over to the browser you will see five different restaurants and the button below says to change color and if you click on that you are able to change it. What I am trying to do is beside the name of the restaurant have the address, phone number but I really don't know how to code it in. I'm sure I do but my mind is not remembering how to do it. Below are my codes..
Here is my class code:
Public Class Restaurant
Private _Id As Integer
Public Property Id() As Integer
[Code]....
how to write the phone number and address beside the restaurant so that way they all show up.
To pass decimal values to radio buttons so I can calculate an output answer. it is a tip calculator. I am using radio buttons as options to choose what amount to tip, ie. 10, 15, and 20%. I need to figure out how to pass the value to the buttons in code so I can calculate the tip amount.
View 1 RepliesI'm creating an emulator for a device to simulate wave forms. My challenge is that when I try to convert the output of the following code, I can't convert the Math.Sin's double output into byte values that lend themselves to the byte array format required by an existing graphing control as listed at bottom below. I''m not sure how to handle this when the sin function creates negative values but the byte values will need to be positive and basically 'shifted up' so that anything over 127 is negative. (0 - 255) unsigned. BitConverter.GetBytes has been suggested but THIS is the result of that attempt.
[Code]....
I'm not sure exactly if the folder icon is in shell32.dll, but nonetheless if it is.Basically, whenever I come across a folder in a FileSystem list, I want to add the icon for a folder to the image list that I am using for the ListView. The problem is that I'm not sure how to reference a specific icon location in a icon collection in a dll.Is this possible with Icon.ExtractAssociatedIcon and shell32.dll?
View 14 RepliesIn VB.NET, let's assume I have the following Structure:
Public Structure Product
Public ItemNo As Int32
Public Description As String[code].....
How would I define a LINQ Query to Sum all of the Product.Cost values in the List? In other words, what would be the LINQ Query in VB.NET to return the value 120.90, which reflects the sum of all three Product Cost values in a single LINQ Query?
I am having a string in CSV format.http:[code].....I can add new values to it by some mechanism. Everything will be same except the new values will have numeric part = 0. Take example I have this exsiting CSV string
1 , abc.txt , 2 , def.doc , 3 , flyaway.txt
Now by some mechanism i added two more files Superman.txt and Spiderman.txt to the existing string. Now it became
1 , abc.txt , 2 , def.doc , 3 , flyaway.txt, 0, Superman.txt, 0 , Spiderman.txt
What i am doing here is that this csv string is paased into SP where its splitted and inserted to db. So for inserting I have to take the files with numeric part 0 only rest will be omiited .Which will be further then converted into CSV string.Array will look like this
str[0]="1"
str[1]="abc.txt"
str[2]="2"[code].....
So at last i want to say my input will be
1 , abc.txt , 2 , def.doc , 3 , flyaway.txt, 0, Superman.txt, 0 , Spiderman.txt
Desired Output:
0, Superman.txt, 0 , Spiderman.txt
I have a program which grabs the source code of a webpage and puts it into a string. I would now like to search the string for two values.
"video_id": "value 1 here"
"t": "value 2 here"
The problem, is that I don't know the position of the values, and I the values change depending on each webpage. All I know, is the text before the value, e.g. "video_id" and "t:"
Here is my code:
Dim videoid As String = TextBox1.Text.Trim
Dim wc As New System.Net.WebClient()
Dim result As String = wc.DownloadString(videoid)
I have a small database from which I need to select specific data for my Windows Form Textbox.I have a table in a database with a few columns: "ID,Date,Val1,Vla2,Val3,OK" (int, date, int, int, int, bool). There are several rows, but only one of the rows has the boolean value as 1 (or 'True').I would like to select all of the information from that row and write it to different TextBoxes.[code]
View 13 RepliesI need help with ASP.NET in the VB.NET language.Currently I have a server that contains a script called Query.aspx. I want this script to evaluate another script, as an example "Test.aspx", and print the evaluated response out as Query.aspx's response.
View 6 RepliesWhen I made the code in the sub generic and passed in the values the timer needed (hour, min, timername) from a start button it seems not to matter which start button is pressed as the labels output the information for the last button pressed.
View 1 Replies