how to phrase my question, but what I am trying to do is inside a for each loop set the item of a model then set the value of that item.
dim td as new project.model.mymodel create model object
For each dr as datarow in dt.rows
dim itemName as string = convert.tostring(dr("Field"))
td.itemName = "6"
next
I keep getting an error that itemName is not part of collection td
I know how to add a item(checkbox) to a toolstrip dynamically, but I want to add a checkbox which is exists in a form. I've tried using the code
[Code]...
but this makes the already existing checkbox, go to the top left of screen and when the toolstrip is click it appears. So I want to add the checkbox to the menu, without going to top left corner,
I have written a Type Converter for a TrackBar. I was wondering if there is any way to get the value being changed in the Dropdown so I can update the PropertyGrid item value dynamically instead of just at the end?
Here is the Type Converter code:
Code:Imports System.Windows.Forms.Design Public Class Slider Private editorService As IWindowsFormsEditorService Private m_Value As Integer
When I open a form the caption is added to my menustrip under open windows. This is fine. However I want to remove this from the menustrip when i close the form.
how I can get this to work. I want to distinguish dropdown controls inside a repeater control. I understand now about the lifecyle and how the buffer is already writen, but what are my alternatives? Here is what happens
Code File
Dim repeatTimes((TotalAdInsured - 1)) As Integer myRepeater.DataSource = repeatTimes myRepeater.DataBind()
Regarding my college project. i'm working on a sales system . i have a form which consist of all the following information( item code , item name , item price , quantity of item ) which is display using a data grid . data input by user using text box and all this information will be stored in a database(sales database) i'm using ms access 2007. the grand total will be displayed in a text box . and amount paid will be input in a text box too , my major problem now is how to i create a reciept that will have all this information of the purcase. i have a reciept button . what the next step ? i dont have any idea how to get the reciept done.
I have a list box on the form which functions as a copy/paste. When you copy something, it is automatically added to the list box as a "clipboard helper". Here is the problem,however: if the text is more than 1 line, the list box does not show all the text.It ends up looking messy.So getting back to my question, is it possible to make the list box item height for an item depending on the amount of lines that item contains?This is a one line sentence in the list box and should take up one line.This is a multi line sentence in the list box and should take up two lines for item height.
In my application I have a listbox and SelectionMode should be MultiSimple because users need to see which items they selected. In another tab we have another listbox this one should show all the selection users had done in first tab. Private Sub
Code: Public Class Form1 Dim NPB As Button Dim x As Integer
[code]....
As you can see, when I open a program from my menu, a new button will be created with text similar to this, "C:Program ". The button it self will not do anything. How can I create the method at the same time the button it is for is created? Also how can I change the text do that it gives me, for example, CCleaner.exe instead of the whole target path?
Assuming an architecture as such.MODEL > BLL > DLL
Trying to implement lazy loading in my MODEL I have run into a circular dependency between my MODEL and BLL..Basically imagine a property in my model that I want to implement as follows
Public Readonly Property ProjectCategory As ProjectCategory Get If Me._ProjectCategory Is Nothing Then Me._ProjectCategory = ProjectCategoryBLL.GetProjectCategoryByID(Me._ProjectCategoryID) End If
[Code]...
I have my MODEL, BLL and DLL in separate projects and because of the fact that my BLL references my model I can not reference my BLL from my model as this would create a circular dependency.
I'm quite new to MVC and while I've been trying to follow the best practices , I believe I may not be understanding certain fundamentals of either
-a. Using models and viewmodels appropriately
-b. Passing models into a controller for validation purposes.
The general purpose of my program is to select a stored procedure from a list of stored procedures, create a form where the user can fill out all the appropriate input variables, and then to execute that stored procedure. The tool is for non-technical people, so I'm eventually going to have to do a good deal of input validation.
As such I have four models: A Script Model, a Parameter Model, a Parameter Enum model and a Query Model, and two viewmodels: a paramviewmodel that generates the form to fill out, and a scriptviewmodel that creates a listbox filled with the possible script choices. I am using a prewritten database system to fill out my viewmodels in an init method in my controller (which I'm not sure is the proper way to do this?).
The viewmodels are as follows:
Imports System Imports System.Collections.Generic Public Class ScriptViewModel
[Code]....
I'm trying to work out the functionality. Also, I think this may be too much code in the view, even though most of it is display code.
Anyways, I have two main questions. One, does creating a model in my controller, calling an init method on it, and then passing it to the view make any sense in an mvc context (if not, how would I proceed?). Two, if I want to perform validation on the form I output in my htmlhelper, but I want to use my query model validation (and not my paramviewmodel), how can I do that? Most of the examples I've seen involve a controller that recieves an appropriate model variable, and the binding is performed outside the controller itself. They then just check modelstate. Is there any way I could do something similar here?
Edit: Is there any way I can make the syntax highlighting less crappy?
I am trying to figure out the best way to implement a certain part of my model.I have an entity named Customer which has CustomerLocations (1-*) which have SalesOrders (1-*) which have Invoices (1-*).I want to allow them to have multiple addresses (Billing and Shipping) per customer and per location. I want to store those values in the sales orders and invoices, not a foreign key, what if they delete one of their addresses later down the road.I have tried complex types, but then they can't have multiple, can they? And having an Address entity, customer --> address (1-*) is ok, but a bit clumsy. How would you have a collection of billing and shipping addresses.?
I have a repository class that defines some basic Get/Save/Delete methods. Inside these, I use NHibernate to do the work on my business entities. For example:
[code]...
However, on my User class I have some properties and collections of other objects that ideally I'd like to be lazy loaded. But of course, the ISession is created and disposed within the repository, which I guess is why, outside of that, when I try to access those properties I get a "Could not initialize proxy - no Session" error.Is my only option then to disable lazy loading when using repositories? Or is it possible (or just foolish) to somehow get the session into scope in the business layer?I do like the repository model, and NHibernate is growing on me (after lots of initial frustration trying to make it work), so what's the best way you gurus have found of using them together?
Hey I am a newcomer to Visual Basic. I am using VB 2008 Express. My problem is I have a combo box filled with model #'s and I would like to have each model # correspond with a different id #, but I have no idea on how to do this, and I have found no documentation on it.
I have a program that prints raw code to Zebra printers. We are adding some Intermec printers. So I would like to be able to pull the Model of the Printer (selected from a standard printer dialog) and use that to chose the code that would be sent to the printer.
My name is Mal, I live in Pelican Waters, Queensland, Australia.There is an application I'd like to build and I have been tossing up between a desktop and a web model. I have been studying PHP and Javascript for the past 2 years. I was studying VB a couple of years ago and have returned to it recently.
I am new to .net, I am just taking a shot in the dark through this whole thing. I have an Addresses table with a StateID and CountryID field. They refer to the States and Countries table. I am using LINQ to SQL and Visual Studio 2010.
To make this easier I will use a concrete example using movies and genres. A genre can be associated with many movies. Genres can increase over time and so can movies.
The use case is as follows. The user wants to filter movies by selecting his/her desired genres.
So, I have a page where at the top there is a section where the user can pick any combination of genres to filter on using checkboxes. Below that is a list of movies that are in those genres.
In MVC I am trying to implement this using a ViewPage(of IDictionary(of Genre, Boolean)) where the boolean is whether or not a particular Genre has been selected for filtering.
I then go into loop that creates checkboxes for them to select:
<% for each genre As KeyValuePair(Of Genre, Boolean) in Model %> <%=Html.Hidden("genre[" & i & "].Key", genre.Key.ID)%> <%=Html.CheckBox("genre[" & i & "].Value", genre.Value)%>
[Code].....
I am aware this can be done using Ajax and I will most likely do it using Ajax but I would still like to know why this doesn't work.
I have a misunderstanding somewhere with the Entity Framework. This code is from my unit testing:
Public Sub UpdateRosterLinkTest() Dim target As PlayerAdmin = New PlayerAdmin() target.PlayerAdminManager = playerAdminTestManager target.Team = playerAdminTestManager.GetAirForceMensBB()
[code]....
When I run this code, I can see the changes saved to the SQL Server this pulls from (RosterLink = Roster Link, like I set in the unit test).However, my unit test is failing, because team.RosterLink is still Nothing. The function GetAirForceMensBB() returns the Team with TeamId = 12434:
Function GetAirForceMensBB() As DAL.Team Return (From team In Container.Teams Where team.TeamId = 12434).SingleOrDefault End Function
I'm sure I'm using the entity framework incorrectly and it probably has something to do with the fact that I am calling the PlayerAdminTestManager in different places, but I don't understand why. Although, I set the PlayerAdminManager to be the PlayerAdminTestManager. PlayerAdminTestManager extends PlayerAdminManager, fyi.Why is team.RosterLink not showing the update from UpdateRosterLink?
EDIT:Container is my ObjectContext. This is how I access the information stored in the database.Container.Teams represents my Teams table.
I am using MS Visual Basic Express 2010 and trying to generate "ADO.Net Entity Framework" entities from an existing local SQL Server Express database.
Using the "Entity Data Model Wizard" I am asked to configure a connection. Here I prompted to choose a "Data source" and given two options 'Microsoft SQL Server Compact 3.5' and 'Microsoft SQL Server Database File'. I select the second option.
I'm then prompted for connection properties, I have to enter the "Database file name (new or existing)". Here I browse to the SQL server database file of interest (found using Management Studio Express) namely[code]...
I am in the process of using a two-dimensional array to find wind chill factors. My application uses a nudTemp for temperature and nudWind for Wind Velocity. When temp and wind are chosen from the nud list, it is supposed to display the wind chill temp in a text box and then display a message box. Right now it does everything it is supposed to do except that it does not display the proper wind chill factor.
I know it is an issue with my arrays so I was provided with an example but I don't know how to modify it so that it matches my code. I have added all of the array values but it is naming the array variables I am having issues with.
Sample code I was provided:
Private arr1 As Integer() = New Integer() {10, 20, 30} Private arr2 As Integer() = New Integer() {100, 200, 300}
[CODE]...
I have provided my code as I have it thus far, listed below.
Anyway for my vb class we need to write an auto inquiry system. Im a total n00b and am struggling altogether. My interface is below Basically what my problem is (among others) is that I don't know how to assign prices to each model from the combo box. This is what I used to populate the two boxes:
How do I retrieve the computer model information?For example, I have a dell inspiron 1545. How do I retrieve that information in a label? I search a lot of WMI information but can't seem to find it. It SAYS 1545 on my system properties