|
sorry i explained the query wrong. i need to use a button to replace the selected item with the one above, and do the same with the one below. i suppose this code could be modified a bit but dont know how. can anyone help me please.
Select Previous:
ListBox1().SelectionMode = SelectionMode.One
If Me.ListBox1.SelectedIndex > 0 Then
Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex - 1
End If
Select Next:
ListBox1().SelectionMode = SelectionMode.One
If Me.ListBox1.SelectedIndex < Me.ListBox1.Items.Count - 1 Then
Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1
End If
|
|
|
|
|
Stop spamming.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
oh i think i understand, you want the selected item on button press to have the same value as the next or previous item.
If that is the case:
Make sure your listbox selectionmode = selectionmode.multiextended
Select all:
ListBox1().SelectionMode = SelectionMode.MultiExtended<br />
For i As Integer = 0 To Me.ListBox1.Items.Count - 1<br />
Me.ListBox1.SetSelected(i, True)<br />
Next
Change current to same as previous:
ListBox1().SelectionMode = SelectionMode.One<br />
Dim Selected As Integer = Me.ListBox1.SelectedIndex<br />
Dim newItem As String<br />
<br />
If Me.ListBox1.SelectedIndex > 0 Then<br />
newItem = Me.ListBox1.Items.Item(Selected - 1)<br />
Me.ListBox1.Items.RemoveAt(Selected)<br />
Me.ListBox1.Items.Insert(Selected, newItem)<br />
Me.ListBox1.SelectedIndex = Selected<br />
End If
Change current to same as next:
ListBox1().SelectionMode = SelectionMode.One<br />
Dim Selected As Integer = Me.ListBox1.SelectedIndex<br />
Dim newItem As String<br />
<br />
If Me.ListBox1.SelectedIndex < Me.ListBox1.Items.Count - 1 Then<br />
newItem = Me.ListBox1.Items.Item(Selected + 1)<br />
Me.ListBox1.Items.RemoveAt(Selected)<br />
Me.ListBox1.Items.Insert(Selected, newItem)<br />
Me.ListBox1.SelectedIndex = Selected<br />
End If
Posted by The ANZAC
|
|
|
|
|
I want to be able to click only on the childs and not the roots in a treeview. Is this possible and if it is can somebody please explain to me how to do it. Thank You!
|
|
|
|
|
If you click only on child nodes how will you ever be able to use the expand/collapse feature of treeviews? This is one of the advantages of using a treeview.
Not saying it's impossible, just think it's a bit weird. What exactly are you trying to do? Maybe I can help.
|
|
|
|
|
I have a datagridview in which I have a list of items some of which are priced in Dollars and some in sterling is there any way to format the columns accordingly.
I have a second column which can be used to pick the currency up from eg.
Roller skates 22.40 USD
Fishing Rod 34 GBP
what I would like to see is
Roller skates $22.40 USD
Fishing Rod £34.00 GBP
I can format the Whole column if they are the same currency using
.CellTemplate.Style.Format = "C2"
I assume this picks up the default currency? If I can alter the currency Symbol for an individual cell then I'm Ok.
Thanks for any help
|
|
|
|
|
Hi
I'm populating an xml file from a dataset. There are some columns that sometimes don't have a value. The problem is that those column names don't appear in the xml file when they don't have a value. How do I get those columns to still appear in the xml file and not be ignored?
Thanks,
RainFox - cunning, with some cloudy clueless moments, yet cool and fresh
|
|
|
|
|
sorry i explained the query wrong. i need to use a button to replace the selected item with the one above, and do the same with the one below. i suppose this code could be modified a bit but dont know how. can anyone help me please.
Select Previous:
ListBox1().SelectionMode = SelectionMode.One
If Me.ListBox1.SelectedIndex > 0 Then
Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex - 1
End If
Select Next:
ListBox1().SelectionMode = SelectionMode.One
If Me.ListBox1.SelectedIndex < Me.ListBox1.Items.Count - 1 Then
Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1
End If
|
|
|
|
|
Continue in the same thread instead of creating a new one.
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
i am creating a notepad in vs05 and i am trying to display the name of the file at the top of the screen when i open a file from desktop. this is the code i've got so far, instead of the file name it displays openfiledialog1. this is very anoying, any help would be appreciated. thanks
this is code i got:
Dim name As String = OpenFileDialog1.FileName
With OpenFileDialog1
.Title = "select file"
.InitialDirectory = "U:\MyDocuments"
.DefaultExt = "rtf"
.Filter = "rich text files(*.rtf)|*.rtf"
.FilterIndex = 1
End With
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
rtb1.LoadFile(OpenFileDialog1.FileName)
Else
MsgBox.show("unknown error during file read")
End If
Me.Text = name
|
|
|
|
|
Replace Me.Text = name with Me.Text = OpenFileDialog1.FileName.
Actually, you would be better writing this section like this:
Dim fileName As String
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
fileName = OpenFileDialog1.FileName
End If
If fileName <> String.Empty Then
rtb1.LoadFile(fileName)
Me.Text = fileName
End If
Don't tell somebody that there was an unknown error just because they clicked Cancel in a dialog box. It is bad form.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
I am trying to export a crystal report to excel format in aspx page using vb as the code behind. I have published the crystal report in the BusinessObjects server and loading in the page load event. I can able to load the crystal report using the below code,
<br />
Dim mySessionMgr As SessionMgr = New SessionMgr<br />
Dim myEnterpriseSession As EnterpriseSession = mySessionMgr.Logon(uname,pwd,servername, AuthType)<br />
Dim myEnterpriseService As EnterpriseService = myEnterpriseSession.GetService("InfoStore")<br />
Dim myInfoStore As InfoStore = New InfoStore(myEnterpriseService)<br />
myEnterpriseService = myEnterpriseSession.GetService("PSReportFactory")<br />
Dim psrfObject As Object = myEnterpriseService.Interface<br />
Dim myPSReportFactory As PSReportFactory = CType(psrfObject, PSReportFactory)<br />
Dim queryString As String = "Select SI_ID, SI_NAME, SI_PARENTID From CI_INFOOBJECTS " _& "Where SI_KIND='CrystalReport' and SI_INSTANCE=0 " _<br />
& "And SI_NAME = 'Report1'"<br />
Dim myInfoObjects As InfoObjects = myInfoStore.Query(queryString)<br />
Dim myInfoObject As InfoObject = myInfoObjects(1)<br />
Dim myReportSource As ReportSource = myPSReportFactory.OpenReportSource(myInfoObject.ID)<br />
<br />
Session("my_rptsrc") = myReportSource<br />
CrystalReportViewer1.ReportSource = myReportSource <br />
But the export options is not working for the instance of my report(myReportSource)
<br />
Dim myExportOptions As New CrystalDecisions.Shared.ExportOptions<br />
Dim myDiskFileDestinationOptions As CrystalDecisions.Shared.DiskFileDestinationOptions<br />
Dim myExportFile As String = "Report1.rpt"<br />
myDiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions<br />
myDiskFileDestinationOptions.DiskFileName = myExportFile<br />
<br />
myExportOptions = myReportSource.ExportOptions<br />
I need to get the export options as in the above code but i m not able to get that(Export option is not available for the instance).
<br />
With myExportOptions<br />
.DestinationOptions = myDiskFileDestinationOptions<br />
.ExportDestinationType = .ExportDestinationType.DiskFile<br />
.ExportFormatType = .ExportFormatType.Excel<br />
End With<br />
myReportSource.Export()<br />
In the above line also export function is not available for the instance myReportSource.
<br />
Response.ClearContent()<br />
Response.ClearHeaders()<br />
Response.ContentType = "application/ms-xls"<br />
Response.WriteFile(myExportFile)<br />
Response.Flush()<br />
Response.Close()<br />
I need help regarding this....
|
|
|
|
|
i am creting a playlist in vb.net and i need to create a few buttons that select all the items in a list and two further buttons to select the item above and item below. can anyone tell me how i would go about that.
|
|
|
|
|
For listbox:
Select All: It is necessary to switch modes on select all
ListBox1().SelectionMode = SelectionMode.MultiSimple<br />
For i As Integer = 0 To Me.ListBox1.Items.Count - 1<br />
Me.ListBox1.SetSelected(i, True)<br />
Next
Select Previous:
ListBox1().SelectionMode = SelectionMode.One<br />
If Me.ListBox1.SelectedIndex > 0 Then<br />
Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex - 1<br />
End If
Select Next:
ListBox1().SelectionMode = SelectionMode.One<br />
If Me.ListBox1.SelectedIndex < Me.ListBox1.Items.Count - 1 Then<br />
Me.ListBox1.SelectedIndex = Me.ListBox1.SelectedIndex + 1<br />
End If<br />
Posted by The ANZAC
|
|
|
|
|
thanks alot matey thats a great help to my cause. much apreciation
|
|
|
|
|
Hi,
I am generating a report in VB.NET.The report is displayed in a grid format.When i preview the print of the report, i can only see half of the grid columns and so the print contains only few columns. Can any1 tell me how i can view all the columns of the grid in the report.I want the print to have all the columns in the same page.
Thanks,
Riz
|
|
|
|
|
Hi, i m now doing my final year project in designing a web page that provide video conferencing service. this service allowed the user to chat face-to-face by using this video conferencing through Internet n webcam.
Please, some one else o anyone can provide me the source code solution in Visual Basic.net 2005 in designing this service.
I m very appreciate for your helping n thank U very much!
|
|
|
|
|
|
Hi..
Im not sure if im posting in correct place. if so please tell me..
however i need to assistance with something to do with VB Express 2005 using
MDB back end database. I have just set a password on my MDB DB and now need to let VB express in Database Explorer where I modify the connection what the password is... but after doing so and set the password in the connection
i get a NOT A VALID PASSWORD when executing my app.
Please help
Robbo
|
|
|
|
|
Make sure your connection string is setup correctly. This site is a good reference for that: http://www.connectionstrings.com[^]
If it is correct, make sure your user and password are the correct letter case (if your user/password is all lower case, make sure it is lower case in your connection string too)
Hope this helps.
|
|
|
|
|
Thanks Kschuler.
My connection string is predefined by VB.NET which im asssuming lives in app.config file. i thought it would be simple to add a password to MDB in access and then tell VB what the new password is which is ok.. however when my app executes and a FILL() is executed it return a "OLEDBexception handler not a valid password " error.
please advise what im missing. please remember my connection string is predefined and i've already checked out connectionstring.com website to no avail.
thanks
|
|
|
|
|
I guess I'm confused with the predefined thing. I usually have a constant in my project that holds my connection string and every time I make a connection I set the connection object to it. Like this:
Dim strConnect as String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=;"
Dim conn as New System.Data.OleDb.OleDbConnection
conn.ConnectionString = strConnect
Dim cmd as New System.Data.OleDb.OleDbCommand
cmd.Connection = conn
Sorry, I can't help you with the predefined connection.
|
|
|
|
|
Hello,
I can view report with crystal report viewer but I want remote users be able to view and print the report using Internet explorer. In order to do that, I need to export crytal report into html programmaticaly. So that when a user click on a button, the report can be viewed in html format.
How Can I do it using vb.net?
Thank you in advance.
programmer
|
|
|
|
|
I am allowing the users to choose multiple background images for my menustrip and statusstrip. I need to know how to set these back to their original images after they have been changed. The text(fore) colors will also change when each image is changed so these need to be set back to their original color as well. Is their something that just sets all the controls on a forms property to what they were at initial form load???? Anyone that can help me with this would be fantastic and will save me many headaches. Thank you!!!!
-Joey
|
|
|
|
|
check for method of the control for something like 'reset'. if there isn't one then look at the designer to know how at design time the control is set and then copy those lines of code and put them in a reset routine to be able to programmatically reset it back to it's original state.
|
|
|
|