ComboBox Value - Each Model # Correspond With A Different Id #
Mar 27, 2010
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 want to create a class (I think) that has properties that correspond to column names in a database table, such that they come up in Intellisense when I type the dot after the class name. Is this possible to do?
I am getting the following error when trying to open a vb .net 1.0 project using VS2002."Unable to open Web project 'ProjectName'.The file path 'FilePath' does not correspond to the URL 'ProjectURL'. The two need to map to the same server location. HTTP 404: Object Not Found."I have tried ALL of the links that Google threw at me (on the first page) on searching on "unable to open web project the two need to map to the same server location" term.I get this error when trying to open an existing vb.net 1.0 project and also when creating a new one.
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?
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 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
I am wondering what I am missing in the attached code that is making it impossible for me to make the VB.NET program below work using MVC (Model-View-Controller). Right now, I am really lost despite my best efforts...
I am trying to implement the observer pattern and think that my code is getting closer to MVC but not quite there yet, firstly because it wont even run ... nevertheless I know that there is someone out there who knows what I am doing wrong and I would definitely benefit from any guidance or help that someone more experienced in MVC VB.NET implementation can give .. hence this letter.
I'm looking for an open-source VB.NET app that demonstrates a lot of .NET's power, ideally something that works fully offline. Maybe some of you have encountered an amazing utility app on CodeProject?
I have a VB.NET 2010 solution, that contains 2 projects, a class library and a Windows Forms Application.The class library basically is a model, used for doing database integration. I currently have the connection string placed in the class library project settings, but they do not seem to be listed anywhere in the config file of the application. What's the best practice for retrieving the connection string in the class library? I don't want to use a singleton. Should it be stored in the application or class library?
I'm trying to avoid the use of magic strings as much as I can, but I can't find the correct syntax for VB to bind a single model like is shown in this c# example. (Currently the below says "expected end of statement" under the Model text). <% Dim FormObject As Form = (Form)Model %> A simple directcast was need <% Dim FormObject As Form = DirectCast(Model, Form)%>
MVC 3, VB.NET, RAZOR app, using EF. I am having an issue in my post function with the database not updating at all... Using a break at db.savechanges() I look at the variable and all of the correct information is contained in the UpdateModel( ) part. But no dice the code executes and returns no errors so all looks fine but when I look at the database table it has not been changed at all, all of the old values are still present.. Function is as follows:
<AcceptVerbs(HttpVerbs.Post)> Function EditCourse(ByVal _eCourse As cours) As ActionResult Dim id As Integer = _eCourse.course_id
I'm kind of torn between these two error-handling models:Create a boolean Error and a string ErrorMessage property for your object. Catch all exceptions internally in the object's methods and pass the messages along using conditional logic from the caller, ie:
[Code]...
To me, it seems like the same amount of code either way, except that you have property code for the Error and ErrorMessage properties. However, you also can tell when an error occurs without having to check for exceptions. Which pattern should I go with?