|
Hi,
I'm using comboboxes in my WindowsForms. I do have a question concerning the ComboBox.ValueMember. Is it possible to store an object in this valuemember?
Thanks!
G72360
|
|
|
|
|
The ComboBox's value property is of type Object, so yes, you can use pretty much anything you want.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I'm making a VB application that contains few reports. Some of reports need to be printed in multi copy fashion i.e. on a single command report should print 5 copies. Any Suggestion how to achieve this and also I want a change in label text i.e. on first copy it shld print "First" on second copy it shld print "Second" and so on till 5th copy?
Thanks in advance
Sumit
|
|
|
|
|
Hello friends
I have a problem related to webservice,how to use webservice using REST.i have never use this one..
My problem is that i have a client which wnat get a xml file which is store on server, so its interect with webservice,and by webservice it will get a url of xml file.then from that URL user will get That XML file.
so i want to use in that process REST with webservice not soap,that is http get or post method..by default ,net framework use the soap..
but i want to implement using REST..
so plz help me..
thanks
chear up..
|
|
|
|
|
Well, REST is not a standard and there is nothing concrete about it, so there is no support for it in the .NET Framework. To rip from an existing web site[^]:
REST is not a standard. You will not see the W3C putting out a REST specification. You will not see IBM or Microsoft or Sun selling a REST developer's toolkit. Why? Because REST is just an architectural style. You can't bottle up that style. You can only understand it, and design your Web services in that style. (Analogous to the client-server architectural style. There is no client-server standard.)
It looks like you don't have a real firm grasp on what REST is all about. You might want to do some research on it first. REST is NOT a transport or serialization method. You have to design your webservice with the IDEA of REST. There is no implementation!!
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi,
i am new in vb.net, i not know how to use datatable in vb.net , what is usefull to me pls define with code it very help full to me. thanks
vipin paliwal
|
|
|
|
|
If all you want is an overview of the DataTable class, read the documentation[^] on it. If you're looking for something more specific, you'll have to ask a more specific question.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Okay guys...I'm new to VB.NET. In fact, the only experience I have is building ASP applications. I have an application I am planning to design no matter how long it takes. It's just something I have to prove to myself I can do. Plus, it will make my work easier if I can accomplish my goals with the application.
I'm using the free VB Express from Microsoft as well as SQL Express. I have described briefly what I want my application to do at my site, http://berrien.homeip.net/application.asp[^] . I have been reading up on OOP and I think I am understanding that pretty well and I have been reading a little on the .NET Framework. I know I have a lot to learn, but I would like to build this application along the way if any of you would be so kind to help me. Thanks guys.
|
|
|
|
|
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
|
|
|
|