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.
I'm probably missing out on something fundamental here but it seems rather tricky and confusing to me so here goes.to demonstrate the issue I have the following example .aspx page
<%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server">
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
Am looping a list object. The list contain 18 object. The loop running 18 times but the end of the 18th one getting Object reference not set to an instance of an object..
@For Each Slogs As SFAMobile.MobileServices.CustomerDetail In Model.Customers @<option value='@Slogs.CustomerId' @selectedVal >@Slogs.Name ( @Slogs.CustomerId ) </option> Next
how to declare scope for variables outside their class?
Here's what i have in a class known Create_User: Public Class Create_User Public conn As New SqlConnection(My.Settings.HotelConnectionString) Public usercmd As SqlCommand
[Code]....
How can i increase the scope of these variables to be used in another class? I dont want to keep declaring them again and again.
[code]In the above code what will be state of 'conn' variable and the 'cmd' variable and the State of the Connection to the DB in the following two case
I'm moving from VB6 to VB.net and there are a few things confusing. In vb.net, your program just automatically has a form, now the form in in a class and so it may or may not be there. In vb6, the main subroutine controls program flow and I don't see that in vb.net. However, my biggest problem is that I have a com dll that has a connect class with events. I need to be able to access these variable outside of that class. I don't understand how to do that. I can't seem to declare public withevents outside of the class and in the namespace so it can be shared with other code. Its say "not valid" in Namespace.
So what is the best way to do that. Do I create a set/get property for the class that holds this value? And, if I do that, is the connect class automatically instantiated as a part of the COM dll? Right now I don't instantiate the connect class, I assume the application does. But I'm not sure exactly how the property of the class would be set...perhaps I would need to call the property set from the on-connection method. Anybody know what the answer to these two questions are and this 3rd one? How can I have a variable that has "events" have scope across the entire project?
While DataReader.Read Dim Foo as New FooBar Foo.Property = "Test" Loop
In VB.net, does this create a new Foo instance every for every loop? Or just one Foo instance with block level scope? Do all blocks (If..EndIf, For..Next) work the same in this regard?
I am writing an App that automates file uploads from users desktops to a specified file server. On the first run of the app, I need the user to select a file server and save it for all other users of that PC. I thought I could do this with application settings but it appears it is not suitable for this purpose. I need suggestions on how I can make this work.
I thought about a registry setting but the user may not have permission to edit the registry based on group policy/security settings.
I also thought about creating an XML file with the file server name that I can read from the installed project directory, but I was hoping there was a more streamlined way.
I have a Function for checking the input in a textbox and only allowing Numeric & Backspace; everything works fine so far. My form is for financials and it has about 20 textboxes; they all receive Numeric only data; there is NO alpha data on the entire form required. Note in the snippet below that I don't even need a decimal point as well.
Is there a way to handle ALL textboxes on this form without having to place the Function call in each textbox KeyPress event. took a long (5 year) hiatus from developing VB6
Public Function TrapKey(ByVal KCode As String) As Boolean If (KCode >= 48 And KCode <= 57) Or KCode = 8 Then TrapKey = False
I have a public variable which seems to be going out of scope. I am confused as it has been dimensioned as a public variable: Public xlCell as As Microsoft.Office.Interop.Excel.Range
I originally had all my code in the same module in the same project and it was wrapped within a For/Next Loop (Example 1). I decided to clean up my code and make it more modular (Example 2). All the code is still in the same module in the same project.
Upon doing so, my public variable is not recognized in any of the private subs that I have created. I keep getting the following error: Message="Object reference not set to an instance of an object." When I test the variable using ?IsNothing(xlCell) in the Main Sub I get False in the main sub. this tells me te variable is recognized. However as soon as the Call SelectCaseSub() is triggered, I get a True value for ?IsNothing(xlCell). Why is this? Shouldn't this variable be in scope regardless?
I have a complex Regex which is used to help strip out HTML from user input. I'm aware that .NET caches static Regex calls to some extent, but this one is big and used frequently, so I'd like it to hang around.[code]...
I've got a simple function that takes a List parameter. While working with it, it copies it and reverses the copy using .NET's List(Of T).Reverse method.
I'm trying to create a simple media player that will scan a directory for certain filetypes, add them to a playlist then play a random playlist entry - changing every x seconds.I figured this would be simple in VB and, to an extent it was. I have the code running that chooses the directory and plays the random file.I just need to now make this repeat every 30 seconds or so.I have all the coded attached under the sub for the 'open' function of the player so it's quite flat. I think I need to use a timer here, to trigger the routine to pick and play the media every 30 seconds?In doing this I think I need to break the variables out of the function I currently have as they need to be shared between the timer loop function and the central 'creating file list' function.
I'm having trouble - I'm no coder (as you'll tell!) and although getting this far was easy I'm now (I think) bumping into threading / variable scope issues which are a bit of a brick wall.I've tried making the variables public / global by declaring in the class rather than the sub but I get errors at runtime. Presumably because of how I'm creating the windows media objects? [code]
where I should declare my variable when using forms and the scope in my test code.
In my code below I have declared variable x in my form1 which can be printed in form2.
But when I create a structure in form1, initialize an array of the type protorec and try to assign values to cards(1).firstname etc... I get a "declartion expected" error.
Why does it work for x but not for cards(x) my array of records?
I am attempting to dynamically dim a variable (i.e. create instance based on user selection).
For example, based on the users selection from a combo box containing report names ("Report A", "Report B", "Report C", etc.), I would like to Dim a report variable (MyReport).
plain how error handling scope works. What I mean by that is if I have a sub called ImportData and in there I have a for loop to go through a list of files and in the for loop I call another sub routine called CheckData. All have catch error in. If a sub has a catch error in where does it go from its call.
If I want to narrow scope of a variable in C#, I can introduce additional braces - i.e.:
class Program { static void Main(string[] args)[code].....
In the ide, I can no longer reference y outside of the scope introduced by the new braces. I would have thought that this would mean that the variable y would be available for garbage collection.(it is interesting to note that when viewing the compiled code using reflector it appears that there is no difference with or without the additional braces)Is there any way similar to this to narrow scope when using VB.net? Does this have any impact on when variables defined in the inner scope may be garbage collected?
I want to create a new instance of a class when I click on a button, but I need to interact with members of that class using other controls on the form, so I need the class to have a global scope. I know I could call the new class in formload, but the class creates certain variables that need to be current. If it is done on formload, the variables wouldn't be current, because if the class is created at formload, it would have different info at that time. Surely, there must be a way to create an instance of the myClass from within a sub that is accessible from other subs of the same class.
I've tried searching and haven't found much useful information on this, I know it has to be possible, but I'm not sure how. I've got an application that bi-directionally syncs with an SQL express 2008 server. right now, I've got a hardcoded sa user in my conection string, however one feature that was asked for was to audit every change made by end users into the database. To implement this, I've created a user login and password for each user that is going to use my app (8 of them) on my sql server, however I now need to change the connection string to include each users name in the string. This is what I've got setup so far:
I am struggling to do what i want with classes at the moment as they are killed off at the end of a method, can somebody let me know how to make the classes live until i tell them to die? so that i can create one and refer to it from another method at another time? For example On form load i create a class Dog.Then later on i want to get info from the Class Dog. But it is no longer instantiated