|
i did like this
For each Item in listbox1.selecteditems
next
cud u tell me what will the Item data type???
and how i will get the selectedvalue??
Er. Jagwinder Singh
|
|
|
|
|
Dim idx as Integer
For Each idx in myListBox.SelectedIndices
' Do something interesting here
Next
I are troll
|
|
|
|
|
Hi Guys,
I need to convert rows to columns,
I have a table shown below
ColA....ColB
X XX
X YY
X ZZ
do you know how to query this table to get a result set like
this below
ColA...ColB...ColC...ColD
X XX YY ZZ
I have tried to use a pivot query but fail to get the desired output,
please help,
thanks in advance
Anoop
|
|
|
|
|
Hi all,
I'am developing a desktop application using vb.net. I've a form with infragistics ultragrid control which populates data from database and three graphs using mschart controls. I want to have a print preview and take a print of the form (including data table and 3 graphs). can anybody provide me with sample code for print preview and print.
Thanks in advance
|
|
|
|
|
here's some code I did for print and print preview using ultragrid(grdgridmaster is the name of my grid).
You will have to code individually for each grid you want to print.
Also drag the UltraPrintPreviewDialog object onto the form.
Private Sub PrintToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintToolStripMenuItem.Click
Dim printdocument1 As New System.Drawing.Printing.PrintDocument
Dim printdialogue1 As New System.Windows.Forms.PrintDialog
Try
printdialogue1.Document = printdocument1
If printdialogue1.ShowDialog() = Windows.Forms.DialogResult.OK Then
grdGridMaster.Print(grdGridMaster.DisplayLayout, printdocument1)
End If
Catch ex As Exception
MessageBox.Show("An error occurred - " + ex.Message)
End Try
End Sub
Private Sub PrintPreviewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintPreviewToolStripMenuItem.Click
Dim UltraGridPrintDocument1 As New Infragistics.Win.UltraWinGrid.UltraGridPrintDocument
UltraPrintPreviewDialog1.Document = UltraGridPrintDocument1
UltraGridPrintDocument1.Grid = grdGridMaster
'maximize the window
Me.UltraPrintPreviewDialog1.WindowState = FormWindowState.Maximized
UltraPrintPreviewDialog1.ShowDialog()
End Sub
|
|
|
|
|
Hi,
I am new to this vb.net, my problem is i have build the windows service in vb.net c#. I deployed it in my system when i am trying to start that service it showing the error as
Error:1053 could not start the service on Local system
The service didnot respond to the start ro control request in a timely fashion
I cleared Applicaton event log also. I checked in system log. It shows the message as follows
1.Information: The Windows Installer service was successfully sent a start control.
2.Information: The Windows Installer service entered the running state.
3.Information: The Windows Installer service entered the stopped state.
4.Error: Timeout (30000 milliseconds) waiting for the windows service to connect.
5.Error: The Samplepolaris service failed to start due to the following error:
The service did not respond to the start or control request in a timely fashion.
I have tried to resolve it, but i could not... Please help me to solve this problem.
Thanks in advance.
With Regards,
Samson
|
|
|
|
|
Always tough to educated guess without seeing some of the startup code but this could be a permission issue. Perhaps your service logon does not have the necessary privileges on the service computer? If you haven't tried debugging the service yet it is really not difficult and I am sure you can google for info on how to debug a windows service.
|
|
|
|
|
From the description, it sounds like you put all of your work code into the OnStart method, never letting it return. This is why the Service Controller threw up the timeout error.
When a service starts, it's expected to setup a seperate thread that does the actual work. Once the thread is setup and started, your OnStart code can return control back to the Service Controller by just getting to the End Sub statement.
|
|
|
|
|
I am using a small vb.net program to download software update files from an internal web site (security is not an issue). The program runs periodically on the users' machines and checks for, downloads and installs new updates that have been placed on the server.
I would like the same program to upload the user name, workstation name, date, etc. to the website and have the website store this information in a text or xml file on the server so I can review it to see who is downloading the updates. It would need to handle the case where multiple people may be downloading simultaneously.
|
|
|
|
|
I would write a web service that can be called to insert the data in to the DB.
|
|
|
|
|
Thanks for the response. I do not do any web development so I need something really specific. We are not supposed to use access databases because they crash the server. I think I am limited to javascript, vbscript (I am familiar with that). I am the site author but I can't install any software to run on the server.
|
|
|
|
|
Your only other option, given your restrictions, is to construct a web page that the client can use to submit the required data. Since you've said that you can't use a database, you're only other option for storing the data is in some kind of flat file, be it text or XML, or whatever...
|
|
|
|
|
So you are saying I cannot automate the process, as in sending a web request to a specially formatted hidden web page via a vb.net standalone EXE from the client computer?
And the only way to accomplish this is to have the user physically enter the data and click a button. Is that correct?
|
|
|
|
|
GTVic wrote: So you are saying I cannot automate the process, as in sending a web request to a specially formatted hidden web page via a vb.net standalone EXE from the client computer?
No, I'm saying you CAN do this. It's not the best solution though. A better one would be a Web Service. Either way, you have to write code that runs on the web server to do the database work.
GTVic wrote: And the only way to accomplish this is to have the user physically enter the data and click a button. Is that correct?
Nope.
|
|
|
|
|
Hey everyone. I'm trying to write some automation to help me test a shell extension witten in c++(not by me).. I'm using VB, and I would like to open windows explorer to a certain folder, then create a folder structure containing files.(I've managed to get this far).. Now I would like to simulate a right click on the folder just created and select one of the options in the menu.. Can anyone suggest how to do this.. I'm not even sure what to search for online, or what I'm trying to do is called..
thanks in advance
|
|
|
|
|
This is going to be much harder than you think. This requires in-depth knowledge of how windows and mouse messages work as well as the internals of Explorer.
There are tools on the market that do exactly this, like IBM's Rational Functional Tester[^], or Mercury TestDirector[^].
|
|
|
|
|
Yah, I realize that, I actually have Rational Functional Tester available, but enjoy the challenge.. I really wanted to work with VB through VS2008 to come up with something.. I guess it isn't as simple as adding a library reference to user32.dll and call in the appropriate methods to get me were I want to go..
|
|
|
|
|
LFlindall wrote: I guess it isn't as simple as adding a library reference to user32.dll and call in the appropriate methods to get me were I want to go..
Oh no. FAR from it!
|
|
|
|
|
Hi,
I have read all items from one listview and I have stored this in another listview. However I want to use one item as group name in 2nd listview. I am able to show all items in 2nd listview but no group headers. I wonder why groups doesn't show up in 2nd listview. Where do I make mistake? All the items are getting listed under default group header.
Thanks.
Private Sub BasketOnCounter()
Dim LCounter As Int32 = 0
Dim Found As Boolean = False
ListView1.BeginUpdate()
'Here we create groups with Artist names
For Each BasketItem As ListViewItem In Form1.ListView6.Items
Found = False
If ListView1.Groups.Count > 0 Then
For Each ArtistItem As ListViewGroup In ListView1.Groups
If ArtistItem.Header = BasketItem.SubItems(0).Text Then
Found = True
Exit For
End If
Next
End If
If Found = False Then
Dim SetGroupName As New ListViewGroup
SetGroupName.Header = BasketItem.SubItems(0).Text
SetGroupName.HeaderAlignment = HorizontalAlignment.Left
ListView1.Groups.Add(SetGroupName)
LCounter += 1
End If
Next
'Here we add items in listview
LCounter = 0
For Each BasketItem As ListViewItem In Form1.ListView6.Items
Try
ListView1.Items.Add(BasketItem.SubItems(1).Text)
ListView1.Items(LCounter).SubItems.Add(BasketItem.SubItems(3).Text)
ListView1.Items(LCounter).SubItems.Add(BasketItem.SubItems(2).Text)
ListView1.Items(LCounter).Group = ListView1.Groups(BasketItem.SubItems(0).Text)
'When I enable the following line the VS2008 is crashing.
ListView1.Groups(BasketItem.SubItems(0).Text).Items.Add(ListView1.Items(LCounter)) here
Catch ex As Exception
MsgBox(ex.ToString & " " & BasketItem.SubItems(0).Text)
End Try
LCounter += 1
Next
ListView1.EndUpdate()
End Sub
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
What's the error that it comes up with??
Did you Enable Visual Styles in your Project properties?? Without it, Grouping will not work in the ListView.
|
|
|
|
|
I enabled the visual styles. I am getting a system null exception error message. I double checked to make sure that Listview has the groups. However during adding and item and then assigning a group to item suppose to list the item under the specified group. The list view list all the items under the default group.
I think I have forgotten something but no idea what it is. The problem is still persit.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
Alright I am making a program for class and my problem is in the 2nd and 3rd parts to my code. The second block is a loop to read stuff from the text file and output it in the lstDisplay. My promlem is I have to figure out a "final total" as seen in the third block. Since the loop redifines the DIM'S "name, rate, hour, and gp" I cannot figure out my total amount. I basically need to add up all the gp's to find my total, however, Since it loops when it gets to the point of my total amount gp obviously only has 1 value which is the final value read from the text file. What could I do to fix this problem and come up with my final value?
Public Class frmPay
Private Sub btnPay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPay.Click
Dim sr As IO.StreamReader = IO.File.OpenText("6-PP-1.txt")
Dim dates, name, rate, hour As String
Dim gp As Double
dates = sr.ReadLine
lstOutput.Items.Clear()
lstOutput.Items.Add("Payroll Report for week ending " & dates)
lstOutput.Items.Add(" ")
Dim headerStr1 As String = "{0,-10}{1,15}{2,15}{3,15}"
Dim headerStr2 As String = "{0,-10}{1,15:C}{2,15}{3,15:C}"
lstOutput.Items.Add(String.Format(headerStr1, "Employee", "Hourly Rate", "Hours Worked", "Gross Pay"))
lstOutput.Items.Add(" ")
Do While sr.Peek <> -1
name = sr.ReadLine
rate = CDbl(sr.ReadLine)
hour = CDbl(sr.ReadLine)
gp = CDbl(rate * hour)
lstOutput.Items.Add(String.Format(headerStr2, name, rate, CStr(hour), gp))
Loop
lstOutput.Items.Add(" ")
lstOutput.Items.Add(String.Format(headerStr1, "Final Total", " ", " ", gp))
sr.Close()
End Sub
End Class
Thanks for the help,
Shawn Deprey
|
|
|
|
|
Hi,
if all you need is the overall total, why not just accumulate while you are enumerating the items, hence put totalGP = totalGP + gp inside the while loop; you need to declare and intialize your accumulating variable before entering the loop. This is elementary; wouldn't you rather buy and study a programming book?
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
I am just starting to learn visual basic. This VB class is my first attempt at coding. Even if it is elementary in the world of high level programming languages. I have to start somewhere I guess.
As for your advice I THINK I understand what you said however I cannot modify my files on the computer I am using so I will test them when I get home in an hour. Thank you for the speedy response Luc!
|
|
|
|
|
Hi Its Shawn again. I first declaired totalgp as a double and put it just outside the loop and then realized how the looping would continuously add gp to total gp if it were inside the loop like you said. You have been a tremendous help. TYVM!
Shawn D.
|
|
|
|