|
What you have described there is commonly known as a Content Management System, or CMS. There are other similar things such as dotnetnuke which are used for maintaining a portal website.
Im not sure how much help you can get here, as this forum is specifically for code related queries.
|
|
|
|
|
what is the coding or basic structure of code that is used to make a remove button for a listbox, so that only teh selected item is removed not the entire list?
also how do you make the clear list remove all files in the list but one? like the name?
thanks
|
|
|
|
|
surfer.chic.robbie wrote: make a remove button for a listbox
Are you saying you want a delete button next to every item in a ListBox? Or just one button that deletes selected items in a ListBox?
surfer.chic.robbie wrote: also how do you make the clear list remove all files in the list but one
You can do this two ways. You can iterate through the list items deleting each item (you can't use For Each for this!!) and skip the one you want. Or you can just wipe out the entire list and recreate the one item you want to keep.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
just a button where something is selected in the listbox that when the remove button is pressed that only it gets removed form the list everything else stays.
|
|
|
|
|
Easy, but with a hidden gotcha. Each the index of each selected item is contained in the ListBox's SelectedIndicies property. All you have to do is go through this list using For/Next , NOT For Each/Next !!, and remove each item from the Items collection at the index listed in SelectedIndicies .
There's the catch though! You have to go through the SelectedIndicies backwards! If you don't, you'll end up with an IndexOutOfRangeException . This is because as you remove items from the ListBox, the size of the collection of Selectedindicies changes. Say you have 10 items selected. At the beginning of the For/next loop, you'll be counting from 0 to 9. But, after you remove the first item, the upper limit of the Selectedindicies collection will be 8, not 9. And so on until your loop, still counting to 9, passes the upper limit of the Selectedindicies collection.
Dim i As Integer
For i = ListBox1.SelectedIndices.Count - 1 To 0 Step -1
ListBox1.Items.RemoveAt(ListBox1.SelectedIndices(i))
Next
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have a problem that is similar that I can not figure out. I am trying to pass an array of a structure to a C++ DLL...
DllExport TFXCAN_RETURNS TFXLibInstallPGNTable(PGNDesc *pDesc);
I have used the following code to declare the function.
<structlayout(layoutkind.sequential, charset:="CharSet.Ansi)"> _
Public Structure PGNDesc
Public i32PGN As Int32
Public u8GrpFunction As Short
Public i8GrpFunctionFieldNo As Short
Public i8InstanceFieldNo As Short
Public u8Priority As UShort
Public bDestGlobal As UShort
Public eProtocol As Integer
Public u8FieldCnt As UShort
Public pFieldList As IntPtr
Public i16DataByteCount As Int16
Public pPropQualifier As IntPtr
Public pMaskValue As IntPtr
End Structure
Public Class PGNComm
Public Declare Auto Function TFXLibPtrTest2 Lib "TFXCAN.dll" Alias "TFXLibPtrTest2" (ByRef PGNArray As PGNDesc, ByVal lIndex As Integer) As Integer
End Class
Here is the code to call the function:
Public Shared Sub Main()
Dim X As Integer = 10
Dim I As Integer, lResult As Integer
Dim oPGNDesc(3) As PGNDesc
For I = 0 To 2
oPGNDesc(I) = New PGNDesc
Next
For I = 0 To 2
With oPGNDesc(I)
.i32PGN = 100
.u8GrpFunction = 101
.i8GrpFunctionFieldNo = 102
.i8InstanceFieldNo = 103
.u8Priority = 104
.bDestGlobal = 105
.eProtocol = 106
.u8FieldCnt = 107
.pFieldList = VarPtr(X)
.i16DataByteCount = 109
.pPropQualifier = VarPtr(X)
.pMaskValue = VarPtr(X)
End With
Next
lResult = Teleflex.TFXLibPtrTest2(oPGNDesc, 0)
This obviously does not work. Any help you can give me would greatly be appreciated.
Ed Hunt, Jr.
|
|
|
|
|
Without seeing the C++ declaration of the structure, it's impossible to tell you if you got the field definitions correct. Also, most basic strucutures require you to prefix the VB.NET Structure specification with a StructLayout Sequential attribute, but that, of course, depends on the structure and the requirements of the function you're trying to pass it to. For example:
<StructLayout(LayoutKind.Sequential)> _
Public Structure PGNDesc
Public i32PGN As Int32
Public u8GrpFunction As Short
Public i8GrpFunctionFieldNo As Short
Public i8InstanceFieldNo As Short
Public u8Priority As UShort
Public bDestGlobal As UShort
Public eProtocol As Integer
Public u8FieldCnt As UShort
Public pFieldList As IntPtr
Public i16DataByteCount As Int16
Public pPropQualifier As IntPtr
Public pMaskValue As IntPtr
End Structure
Dave Kreskowiak
Microsoft MVP - Visual Basic
-- modified at 21:29 Wednesday 12th April, 2006
|
|
|
|
|
hi.
how i can update value of key in configuration file?!
i'm using vb.net 2005
123
|
|
|
|
|
|
NET Framework 2.0 allows updating configuration file
Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
Changing here
config.Save()
|
|
|
|
|
Whoops! I missed the "2005" part of his post. My bad!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I have filled a dataset with my customers ok, but I am running in to some problems when trying to create a multi coloumn combobox with the data set.
When I run the code below, I receive the message "Object reference not set to an instance of an object" at this for loop....
For Each drDSRow In ds.Tables("tblCustomer").Rows:
When I look into my CustomerDataset, I can see my table, and indeed it is called tblCustomer.
Here is what I am trying to accomplish:
'Retrieve the data into a DataSet:
Me.TblCustomerTableAdapter.Fill(Me.CustomerDataset.tblCustomer)
Dim drDSRow As DataRow
Dim drNewRow As DataRow
Dim ds As New DataSet
'Create and populate the DataTable to bind to the ComboBox:
Dim dt As New CustomerDataset.tblCustomerDataTable
dt.Columns.Add("Cust Name", GetType(System.String))
dt.Columns.Add("Cust Number", GetType(System.String))
'populate Datatable
For Each drDSRow In ds.Tables("tblCustomer").Rows
drNewRow = dt.NewRow
drNewRow("Cust Name") = drDSRow("Cust_Name")
drNewRow("Cust Number") = drDSRow("Cust_Number1")
dt.Rows.Add(drNewRow)
Next
'bind datatable to the combobox by setting the combobox's datasource property to the datatable.
Me.cboDealerSelector.DropDownStyle = ComboBoxStyle.DropDownList
With Me.cboDealerSelector
.DataSource = dt
.DisplayMember = "Cust_Name"
.ValueMember = "Cust_Number1"
'.SelectedIndex = 0
End With
Dim aIndex As Integer
With Me.cboDealerSelector
For aIndex = 0 To .Items.Count - 1
If CType(.Items(aIndex)(1), String).Trim = TextBox2.Text.Trim Then
.SelectedIndex = aIndex
Exit For
End If
Next
If aIndex >= .Items.Count Then .SelectedIndex = -1
End With
Any suggestions is greatly appreciated.
Thanks,
Rashar
-- modified at 15:41 Wednesday 12th April, 2006
|
|
|
|
|
Rashar wrote: When I look into my CustomerDataset, I can see my table, and indeed it is called tblCustomer.
Great! But that not what your code is referencing:
For Each drDSRow In ds.Tables("tblCustomer").Rows
doesn't have anythign to do with your CustomerDataset. You created a new empty DataSet object, called ds , but you never filled it with anything. So, yes, the Tables("tblCustomer") reference returns Nothing . Since you're now trying to access the properties, Rows count, of a Nothing object, it'll throw the "Object reference not set to an instance of an object" error you're seeing.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I'm displaying search results in a listview control and I want to highlight or at least make the searched text bold in the listview items and subitems. Can anyone help please?
Thanks,
Ruki
Ruki
|
|
|
|
|
You can't just highlight items, or parts of items, in the ListView. You're best option would be to create your own ListView that exposes this functionality, inheriting from the normal ListView class. You'll have to owner-draw the ListView items yourself. You can search the articles for "custom listview[^]" for examples.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi Dave,
Thanks for the input. I understand this has to be done using owner-draw, but I'm bit lost with this. Can U pls help?
cheers,
Ruki
|
|
|
|
|
I already did. Read the articles. Owner-drawing is a subject that takes up entire articles. Much too much information for a forum post.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I'm displaying search results in a listview control VB.Net and I want to highlight or at least make the searched text bold in the listview items and subitems. Can anyone help please?
Thanks,
Ruki
Ruki
|
|
|
|
|
I am trying to find a masked textbox(textbox with input mask capability) to be used in a web form. I find plenty of masked textbox for winform.
Thanks
Seeker55
Seeking that which expands the limit
|
|
|
|
|
How can I change a Cursor Image with the MouseEnter/MouseLeave event of a control? VB 6 used to have a Custom Image choice but I cannot find any such option with VB.NET.
Thanks
|
|
|
|
|
You still use the MouseEnter and MouseLeave events of the control. Then you just set the Cursor property to whatever you want:
Private Sub Button1_MouseEnter(blah, blah) Handles Button1.MouseEnter
Cursor = Cursors.Hand
End Sub
Private Sub Button1_MouseLeave(blah, blah) Handles Button1.MouseLeave
Cursor = Cursors.Default
End Sub
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave, Thanks for your response. If I wanted to change 'Cursor = Cursors.Hand' to an image of my choice I would have to load the Cursor=Cursor.(from a file location "C:\Icons\MyChoice.ico)?
Pete
|
|
|
|
|
You can read up on the <a href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.cursor(VS.80).aspx" rel="nofollow">Cursor</a>[<a href="http://msdn2.microsoft.com/en-us/library/system.windows.forms.cursor(VS.80).aspx" target="_blank" rel="nofollow" title="New Window">^</a>] class first. You cannot use an *.ico file for a cursor though. Only *.CUR files are supported!! And only in black and white with no animation!!
Cursor = New Cursor(filepath.cur)
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi!
I have a problem with VB and ICQ.
E.g i run:
TaskID = Shell("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE /c ipm.note /m " & Form2.Label1(8), vbNormalFocus)
Label (8) is like "john.smith@usa.com" This works fine. Outlook opens and the Adress is set to "john.smith@usa.com"
But...
I cant get it work with ICQ in the way that the contacts ICQ-number is used at a parameter and both ICQ and the contact/message window will open.
I get the ICQ opened using the line below but the user 327414049 will not be opened.
TaskID = Shell("c:\Program Files\ICQlite\Icqlite.exe 327414049", vbNormalFocus)
Any suggestion?
/Samb
|
|
|
|
|
That would depend on if IcqList supports command line arguments. I have no idea if it does. If not, there's not much you can do about it.
Check out hte documentation on ICQ Lite or try launching it with the /? switch on its command line.
Dave Kreskowiak
Microsoft MVP - Visual Basic
-- modified at 21:00 Wednesday 12th April, 2006
|
|
|
|