
joe_pool_is
Avatar/Signature-
Posts
512 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by joe_pool_is
-
PlausiblyDamp, YES, YES! I am happy to show you my code!!! :) In fact, I have taken the whole darned project and zipped it up into the aspnet-client.zip file. If you can tell me anything, I would really, really appreciate it. I've got deadlines creaping up on me, and no one up here at work knows what the problem with that is. Note: There are still bugs in the SignUp.aspx form, especially in the SQL statements. I'm working on those, too. As soon as I get this Page_Load problem fixed, I'll get back to debugging my SQL issues. aspnet-client.zip
-
Whenever I start my web application, it runs through the Page_Load subroutine twice. Why twice? I only want it to execute this portion once. Then, whenever I click the SUBMIT button, again my code runs executes the Page_Load subroutine twice before dropping down to the SUBMIT.Click routine. This causes all of my form's data to be lost! Could someone please help? I am very confused. (Yes, the SUBMIT button is an ASP control with an event handler.)
-
Thanks! I never knew the Page keyword was there. I have another question that you may be able to help me with: On my form, when I click SUBMIT, the page reloads some of the time (but not all of the time). I put a breakpoint on the "Sub btnSUBMIT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handels btnSUBMIT.Click", but even when I click the SUMBIT button, the debugger never goes to this sub - It goes straight to Page_Load. What is this? Could you offer any solution(s) here?
-
I have put together a small form with 3 different DropDownLists. The items to each DropDownList is loaded programatically during the onLoad event. One is ddlIDType (where the customer enters their ID Type), One is ddlState (where the customer enters their home state), and One is ddlYear (where the customer enters the year of their birth). In my code, I gather the information as follows: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim MyList As New DropListData ' A class I have with all the states and years ddlState.DataSource = MyList.StateList ddlState.DataBind() ddlYear.DataSource = MyList.YearList ddlYear.DataBind() With ddlIDType.Items .Add("Driver's License") .Add("Passport") .Add("Alien Registration") .Add("Govt. Employee") .Add("Military") End With End Sub Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click Dim strCustomerInfo as String = "" strCustomerInfo &= ddlIDType.SelectedItem.Text strCustomerInfo &= ddlState.SelectedItem.Text strCustomerInfo &= ddlYear.SelectedItem.Text End Sub The IDType field works the way it should, but State and Year do not. This leads me to believe that somehow my databinding is not working the way I want it to. The data shows up in each of the DropDownList when I run the webpage. When I click the btnSubmit button, State and Year consistantly return the topmost value, no matter which value was selected. Could someone explain what is going on, and how I could correct this?
-
I'm having similar problems. How would I add these ASP.NET write permissions? I do not own the ISP; we just rent a little space from them to post our site. Also, in the database file's "Properties > Security > Add > Object Name", I read: So is <YOURMACHINE> = localhost or the website's domain name?
-
Well, guess what? Somehow, I managed to solve it. For those of you interested to know how I managed it, here's what I did: First: I commented out the entire code, so that my form displayed again. Second: I uncommented small sections, flipping back to the Designer as I did. Third: Got to some Click and Double Click events, and simply redid them the .NET way instead of uncommenting those sections. Tada! Thanks for listening to me ramble.
-
Okay, I found this in the Help File, but doesn't help me figure out how to fix my form: What is HRESULT: 0x80047E2C? This error can occur when you manipulate the CodeModel objects of Visual Basic source files. When you are writing code that maintains references to CodeElement objects, you should be aware that the underlying source code can change while you are holding the reference. The code element may be deleted, renamed, or involved in a compiler error. When this happens, any calls to the CodeElement object will return the error message "Exception from HRESULT: 0x80047E2C." Once a reference becomes invalid in this way, it cannot be recovered. To fix this problem, you need to fix any errors in the source code and retrieve a new reference from the CodeModel object. The following macros demonstrate how this error might occur. Add a class named LostClass to your project. Make this a top-level class, not inside a namespace or class. Run the SetElement macro, delete the class, and then run the GetElement macro. When you run GetElement, the class no longer exists, and the lostClass reference is invalid and returns the error. Public Module CreateLostClass Dim lostClass As CodeElement Sub SetElement() Dim proj As Project = DTE.Solution.Projects.Item(1) lostClass = proj.CodeModel.CodeElements.Item("LostClass") MsgBox(lostClass.Name) End Sub Sub GetElement() MsgBox(lostClass.Name) End Sub End Module
-
Does anyone know what the error message in the subject line is trying to tell me? I was making small tweaks to a form that I had copied over from VB6 to VB.NET. It had been doing great, but now when I click on the Design View I get this message: An error occurred while loading the document. Fix the error, and then try loading the document again. The error message follows: Exception from HRESULT: 0x80047E2C I have no idea! Not much was changed between the two versions, and I believe I commented out everything that was new.
-
There are a few things I've seen on web pages that I don't know how to do. Could someone show me how to do them? 1. When entering a phone number, the form automatically inserts the parenthesis () and hyphens [i.e. (999) 999-9999], or when entering a SSN, the form automatically jumps from one textbox to the next when the correct number of digits is entered. How does this happen? 2. Similar to above: Customer enters his mailing address, and below the form asks for his billing address. If Customer checks a button labeled "Mailing address is same as Billing address", the billing info is automatically populated with data from the mailing address. How does that happen? 3. If someone types in a value with an incorrect format (i.e. fields left blank or alpha letters found where numbers expected), a message box pops up to inform them. Every time I try to call a Message Box, I get an error. How do you do that? Answer one question: You have done some programming before. Answer two questions: You have done a lot of this before! Answer all three questions: I bow before you.
-
Boy, that's embarrassing.... I tried entering the following code for collecting my data: [font=Fixedsys][color=#0000ff]Private[/color] [color=#0000ff]Sub[/color] btnSubmit_Click([color=#0000ff]ByVal[/color] sender [color=#0000ff]As[/color] System.Object, [color=#0000ff]ByVal[/color] e [color=#0000ff]As[/color] System.EventArgs) [color=#0000ff]Handles[/color][/font][font=Fixedsys] btnSubmit.Click[/font] [font=Fixedsys][color=#0000ff][color=#008000] [/color]Dim[/color] objCtrl [color=#0000ff]As[/color] [color=#0000ff]Object[/color][/font] [font=Fixedsys][color=#0000ff][color=#008000] [/color]Dim[/color] strInfo [color=#0000ff]As[/color] [color=#0000ff]String[/color][/font] [font=Fixedsys][color=#008000] [/color]strInfo = ""[/font] [font=Fixedsys][color=#0000ff][color=#008000] [/color]For[/color] [color=#0000ff]Each[/color] objCtrl [color=#0000ff]In[/color] [color=#0000ff]Me[/color][/font][font=Fixedsys].Controls[/font] [font=Fixedsys][color=#0000ff][color=#008000] [/color]Select[/color] [color=#0000ff]Case[/color][/font][font=Fixedsys] (objCtrl.GetType.Name)[/font] [font=Fixedsys][color=#0000ff][color=#008000] [/color]Case[/color][/font][font=Fixedsys] "RadioButton"[/font] [font=Fixedsys][color=#008000] [/color]strInfo &= objCtrl.checked.ToString & vbCrLf[/font] [font=Fixedsys][color=#0000ff][color=#008000] [/color]Case[/color][/font][font=Fixedsys] "DropDownList"[/font] [font=Fixedsys][color=#008000] [/color]strInfo &= objCtrl.SelectedValue.ToString & vbCrLf[/font] [font=Fixedsys][color=#0000ff][color=#008000] [/color]Case[/color][/font][font=Fixedsys] "CheckBox"[/font] [font=Fixedsys][color=#008000] [/color]strInfo &= objCtrl.Checked.ToString & vbCrLf[/font] [font=Fixedsys][color=#0000ff][color=#008000] [/color]Case[/color][/font][font=Fixedsys] "ListBox"[/font] [font=Fixedsys][color=#0000ff][color=#008000] [/color]Dim[/color] objValue [color=#0000ff]As[/color] [color=#0000ff]Object[/color][/font] [font=Fixedsys][color=#0000ff][color=#008000] [/color]For[/color] [color=#0000ff]Each[/color] objValue [color=#0000ff]In[/color][/font][font=Fixedsys] objCtrl.selectedValue[/font] [font=Fixedsys][color=#008000] [/color]strInfo &= objValue.SelectedValue.ToString & vbCrLf[/font] [color=#0000ff][font=Fixedsys][color=#008000] [/color]Next[/font][/color] [font=Fixedsys][color=#0000ff][color=#008000] [/color]Case[/color][/font][font=Fixedsys] "TextBox"[/font] [font=Fixedsys][color=#008000] [/color]strInfo &= objCtrl.text & vbCrLf[/font] [font=Fixedsys][color=#0000ff][color=#008000] [/color]End[/color] [color=#0000ff]Select[/color][/font] [color=#0000ff][font=Fixedsys][color=#008000] [/color]Next[/font][/color] [font=Fixedsys][color=#0000ff]End[/color] [/font][color=#0000ff][font=Fixedsys]Sub[/font][/color] But my output was no where near what I as expecting. In the "Immediate Window" I got this: [font=Fixedsys]?objCtrl.GetType.FullName[/font] [font=Fixedsys]"System.Web.UI.ResourceBasedLiteralControl"[/font] [font=Fixedsys]?objCtrl.GetType.FullName[/font] [font=Fixedsys]"System.Web.UI.HtmlControls.HtmlForm"[/font] [font=Fixedsys]?objCtrl.GetType.FullName[/font] [font=Fixedsys]"System.Web.UI.LiteralControl"[/font] Have I done something extremely wrong? Also, why isn't my VB code posting correctly? I am placing it within ["VB"] tags, but when I cut and past from VS.NET, it originally populates the text with Size=1, Face=Verdana. Is there a setting I am missing somewhere?
-
Thanks Bobby ... er, Robbie! (sorry about that last slip)
-
I am looking for a smarter method of collecting data from a webform. The form I am currently working on only has 15 different variables to collect from, but a form could forseeably have many more. Currently, to collect form data, I am stuck writing something like this: [font=Courier New][color=black]Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles[/color][/font][font=Courier New][color=black] btnSubmit.Click [/color][/font][font=Courier New][color=black] Dim strCollection As String [/color][/font][font=Courier New][color=black] strCollection = txtName.Text strCollection &= txtAddress.Text strCollection &= chkHasInternet.Checked.ToString[/color][/font] [font=Courier New][color=black] ' // etc. [/color][/font][font=Courier New][color=black]End [/color][/font][color=#0000ff][font=Courier New][color=black]Sub[/color][/font][color=black][/color][/color] Like I said: That works, but a "smarter way" would be something like this: [font=Courier New][color=black]Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles[/color][/font][font=Courier New][color=black] btnSubmit.Click[/color][/font] [font=Courier New][color=black] Dim objVariable as Object [/color][/font][font=Courier New][color=black] Dim strCollection As String[/color][/font] [font=Courier New][color=black] strCollection = "" [/color][/font][font=Courier New][color=black] For Each objVariable In Me.Controls[/color][/font] [font=Courier New] strCollection &= objVariable.ToString & vbCrLf[/font] [font=Courier New] Next[/font][color=black] [/color][font=Courier New][color=black]End [/color][/font][color=#0000ff][font=Courier New][color=black]Sub[/color][/font][color=black] However, the "smarter way" works too well: It seems to be returning to me the string value of everything on the webpage. Is there a way to tell my code that I only want to collect my data from the input fields? Also, I would appreciate any suggestions on the best way to handle large collections of data such as this. My "smarter way" is probably not the best way. Thanks in advance for your help, Joe[/color][/color]
-
Paul and Bobby, Thanks for your help. This is working now. Whereas Bobby's answer was correct and to the point, Paul's "Detailed Epic" was perfect for keeping me from having to ask any further questions. Thanks!
-
One more thing: I am trying to develop this further. I am building a class called DDLClass.vb that I am populating with different data variables (List of US States, Months of the Year, Days of the Month, Years, etc.). I am designing this in such a way that I can use it over and over. [size=1][color=#0000ff]Public[/color][/size][size=1] [/size][size=1][color=#0000ff]Class[/color][/size][size=1] DropListData [/size][size=1][color=#0000ff]Dim[/color][/size][size=1] oData [/size][size=1][color=#0000ff]As[/color][/size][size=1] [/size][size=1][color=#0000ff]New[/color][/size][size=1] ArrayList [/size][size=1][color=#0000ff]Private[/color][/size][size=1] [/size][size=1][color=#0000ff]Enum[/color][/size][size=1] DropListOptions enmStates enmMonths enmDaysOfMonth enmYears [/size][size=1][color=#0000ff]End[/color][/size][size=1] [/size][size=1][color=#0000ff]Enum [/color][/size][size=1][/size][size=1][color=#0000ff]Public[/color][/size][size=1] [/size][size=1][color=#0000ff]Sub[/color][/size][size=1] [/size][size=1][color=#0000ff]New[/color][/size][size=1]([/size][size=1][color=#0000ff]ByVal[/color][/size][size=1] intOption [/size][size=1][color=#0000ff]As[/color][/size][size=1] [/size][size=1][color=#0000ff]Integer[/color][/size][size=1]) [/size][size=1][color=#0000ff]Select[/color][/size][size=1] [/size][size=1][color=#0000ff]Case[/color][/size][size=1] intOption [/size][size=1][color=#0000ff]Case[/color][/size][size=1] DropListOptions.enmStates [/size][size=1][color=#0000ff]With[/color][/size][size=1] oData .Add("AL - ALABAMA") .Add("AK - ALASKA") .Add("AR - ARKANSAS") .Add("AZ - ARIZONA") .Add("CA - CALIFORNIA") .Add("CO - COLORADO") .Add("CT - CONNECTICUT") .Add("DC - DISTRICT OF COLUMBIA") .Add("DE - DELAWARE") .Add("FL - FLORIDA") .Add("GA - GEORGIA") .Add("HI - HAWAII") .Add("ID - IDAHO") .Add("IA - IOWA") .Add("IL - ILLINOIS") .Add("IN - INDIANA") .Add("KS - KANSAS") .Add("KY - KENTUCKY") .Add("LA - LOUISIANA") .Add("MA - MASSACHUSETTS") .Add("MD - MARYLAND") .Add("ME - MAINE") .Add("MI - MICHIGAN") .Add("MO - MISSOURI") .Add("MN - MINNESOTA") .Add("MS - MISSISSIPPI") .Add("MT - MONTANA") .Add("NC - NORTH CAROLINA") .Add("ND - NORTH DAKOTA") .Add("NE - NEBRASKA") .Add("NH - NEW HAMPSHIRE") .Add("NJ - NEW JERSEY") .Add("NM - NEW MEXICO") .Add("NY - NEW YORK") .Add("NV - NEVADA") .Add("OH - OHIO") .Add("OK - OKLAHOMA") .Add("OR - OREGON") .Add("PA - PENNSYLVANIA") .Add("PR - PUERTO RICO") .Add("RI - RHODE ISLAND") .Add("SC - SOUTH CAROLINA") .Add("SD - SOUTH DAKOTA") .Add("TN - TENNESSEE") .Add("TX - TEXAS") .Add("UT - UTAH") .Add("VA - VIRGINIA") .Add("VT - VERMONT") .Add("WA - WASHINGTON") .Add("WI - WISCONSIN") .Add("WV - WEST VIRGINIA") .Add("WY - WYOMING") [/size][size=1][color=#0000ff]End[/color][/size][size=1] [/size][size=1][color=#0000ff]With [/color][/size][size=1][/size][size=1][color=#0000ff]Case[/color][/size][size=1] DropListOptions.enmMonths [/size][size=1][color=#0000ff]With[/color][/size][size=1] oData .Add("01 - January") .Add("02 - February") .Add("03 - March") .Add("04 - April") .Add("05 - May") .Add("06 - June") .Add("07 - July") .Add("08 - August") .Add("09 - September") .Add("10 - October") .Add("11 - November") .Add("12 - December") [/size][size=1][color=#0000ff]End[/color][/size][size=1] [/size][size=1][color=#0000ff]With [/color][/size][size=1][/size][size=1][color=#0000ff]Case[/color][/size][size=1] DropListOptions.enmDaysOfMonth [/size][size=1][color=#0000ff]With[/color][/size][size=1] oData .Add("01") .Add("02") .Add("03") .Add("04") .Add("05") .Add("06") .Add("07") .Add("08") .Add("09") .Add("10") .Add("11") .Add("12") .Add("13") .Add("14") .Add("15") .Add("16") .Add("17") .Add("18") .Add("19") .Add("20") .Add("21") .Add("22") .Add("23") .Add("24") .Add("25") .Add("26") .Add("27") .Add("28") .Add("29") .Add("30") .Add("31") [/size][size=1][color=#0000ff]End[/color][/size][size=1] [/size][size=1][color=#0000ff]With [/color][/size][size=1][/size][size=1][color=#0000ff]Case[/color][/size][size=1] DropListOptions.enmYears [/size][size=1][color=#0000ff]With[/color][/size][size=1] oData .Add("1900") .Add("1901") .Add("1902") .Add("1903") .Add("1904") .Add("1905") .Add("1906") .Add("1907") .Add("1908") .Add("1909") .Add("1910") .Add("1911") .Add("1912") .Add("1913") .Add("1914") .Add("1915") .Add("1916") .Add("1917") .Add("1918") .Add("1919") .Add("1920") .Add("1921") .Add("1922") .Add("1923") .Add("1924") .Add("1925") .Add("1926") .Add("1927") .Add("1928") .Add("1929") .Add("1930") .Add("1931") .Add("1932") .Add("1933") .Add("1934") .Add("1935") .Add("1936") .Add("1937") .Add("1938") .Add("1939") .Add("1940") .Add("1941") .Add("1942") .Add("1943") .Add("1944") .Add("1945") .Add("1946") .Add("1947") .Add("1948") .Add("1949") .Add("1950") .Add("1951") .Add("1952") .Add("1953") .Add("1954") .Add("1955") .Add("1956") .Add("1957") .Add("1958") .Add("1959") .Add("1960") .Add("1961") .Add("1962") .Add("1963") .Add("1964") .Add("1965") .Add("1966") .Add("1967") .Add("1968") .Add("1969") .Add("1970") .Add("1971") .Add("1972") .Add("1973") .Add("1974") .Add("1975") .Add("1976") .Add("1977") .Add("1978") .Add("1979") .Add("1980") .Add("1981") .Add("1982") .Add("1983") .Add("1984") .Add("1985") .Add("1986") .Add("1987") .Add("1988") .Add("1989") .Add("1990") .Add("1991") .Add("1992") .Add("1993") .Add("1994") .Add("1995") .Add("1996") .Add("1997") .Add("1998") .Add("1999") .Add("2000") .Add("2001") .Add("2002") .Add("2003") .Add("2004") .Add("2005") [/size][size=1][color=#0000ff]End[/color][/size][size=1] [/size][size=1][color=#0000ff]With [/color][/size][size=1][/size][size=1][color=#0000ff]End[/color][/size][size=1] [/size][size=1][color=#0000ff]Select [/color][/size][size=1][/size][size=1][color=#0000ff]End[/color][/size][size=1] [/size][size=1][color=#0000ff]Sub End[/color][/size][size=1] [/size][size=1][color=#0000ff]Class[/color][/size] Are my techniques above good or are there better ways? Here is a snippet of my main .ASPX code: [size=1] [/size][size=1][color=#0000ff]Private[/color][/size][size=1] [/size][size=1][color=#0000ff]Sub[/color][/size][size=1] Page_Load([/size][size=1][color=#0000ff]ByVal[/color][/size][size=1] sender [/size][size=1][color=#0000ff]As[/color][/size][size=1] System.Object, [/size][size=1][color=#0000ff]ByVal[/color][/size][size=1] e [/size][size=1][color=#0000ff]As[/color][/size][size=1] System.EventArgs) [/size][size=1][color=#0000ff]Handles[/color][/size][size=1] [/size][size=1][color=#0000ff]MyBase[/color][/size][size=1].Load [/size][size=1][/size][size=1][color=#0000ff]Dim[/color][/size][size=1] oStates [/size][size=1][color=#0000ff]As[/color][/size][size=1] [/size][size=1][color=#0000ff]New[/color][/size][size=1] DropListData([/size][size=1][color=#0000ff]Me[/color][/size][size=1].DropListOptions.enmStates) [/size][size=1][color=#0000ff]Dim[/color][/size][size=1] oMonths [/size][size=1][color=#0000ff]As[/color][/size][size=1] [/size][size=1][color=#0000ff]New[/color][/size][size=1] DropListData([/size][size=1][color=#0000ff]Me[/color][/size][size=1].DropListOptions.enmMonths) [/size][size=1][color=#0000ff]Dim[/color][/size][size=1] oDays [/size][size=1][color=#0000ff]As[/color][/size][size=1] [/size][size=1][color=#0000ff]New[/color][/size][size=1] DropListData([/size][size=1][color=#0000ff]Me[/color][/size][size=1].DropListOptions.enmDaysOfMonth) [/size][size=1][color=#0000ff]Dim[/color][/size][size=1] oYears [/size][size=1][color=#0000ff]As[/color][/size][size=1] [/size][size=1][color=#0000ff]New[/color][/size][size=1] DropListData([/size][size=1][color=#0000ff]Me[/color][/size][size=1].DropListOptions.enmYears) [/size][size=1]ddlState.DataSource = oStates ddlState.DataBind() ddlState1.DataSource = oStates ddlState1.DataBind() ddlState2.DataSource = oStates ddlState2.DataBind() ddlDOBMonth.DataSource = oMonths ddlDOBMonth.DataBind() ddlDOBDay.DataSource = oDays ddlDOBDay.DataBind() ddlDOBYear.DataSource = oYears ddlDOBYear.DataBind() [/size][size=1][color=#0000ff]End[/color][/size][size=1] [/size][size=1][color=#0000ff]Sub[/color][/size] For some reason, the .DataBind() section is throwing up an error right now. Any thoughts? Where can I get more info on how to do this sort of thing? What would I search under? The keyword "list" returns too many irrelevant topics. I hope my code helps others, and I look forward to getting some feedback from others.
-
Thanks, Paul. That works great! I would be interested in seeing your "complex version" as well if you have time. If you would rather email it to me, that would be fine.
-
I am putting together a site with several identical DropDownLists. Particularly, I have 4 different STATE lists. Instead of adding all of the US states [i.e. StateList1.Item.Add("TEXAS")] for each DropDownList, I am looking for a more elegant approach. I tried defining a class, then declaring the DropDownList as the new class. Obviously, that did not work. Could someone describe an elegant way to approach this? Thanks in advance to those who respond.
-
I am putting together a small project that will run on a PC that I want to be able to interact with online services. Here is the idea (very basic): From the PC application, the user clicks the ONLINE button which sends data to a website. The website returns a value that the PC application can then work with. Here are my questions: 1. How would the PC application send data to an ONLINE application? I have added links to open websites before, but I have never passed data from variables. 2. How does the ONLINE service retrieve this information? I have noticed from search engines, etc. that information is often passed using Question Marks (?), ampersands (&), and space indicators (%20%). (For example: The link I am currently on is: http://www.xtremedotnettalk.com/newthread.php?do=newthread&f=62) How does my .aspx application gather this info? 3. How does my ONLINE service return a response to the PC application? Would I need to declare values in my application as Public and try to write to them using the ONLINE service? (I seriously doubt this would work, but that's all I can think to try) Obviously, I have never done this before. I have created simple .aspx forms on a website that someone would have to direct their browser to, and it in turn would send emails or populate databases. I have never had an application that could interact with a web service directly. Thanks in advance for any of your help, Joe
-
If you get a moment, could you show a newbie like me how to do something like that? That would come in very helpful with some of the projects I am working on.
-
Header files are external to your program. Typically, these files will include definitions for many, many variables of something that you want to work with. The best analogy I can think of is the way .NET uses Imports System.Mathor something like that. You don't have to worry about defining PI all over again. For me, I am working with some OpenGL components, and there are tons of examples out there referencing header files written in C or C++. A few sites have created applications that will run OpenGL in .NET, but I still want to know how to include a header file.
-
If possible, could someone include how to accomplish this in VB.NET as well?
-
One of our contractors has left our company, and I have been unlucky enough to inherit his project. He was very experienced with VB6 and earlier, whereas I have only worked with VB.NET (for the last year or so) and C. A lot of his code looks like this: Public Event AddImage() Private Sub HandleAddImage() RaiseEvent AddImage() End Sub Public Function Add(...) As Layer .... AddHandler MyLayer.AddImage, AddressOf HandleAddImage() .... End Function Public Sub Remove(...) .... RemoveHandleer MyLayer.AddImage, AddressOf HandleAddImage .... End SubCould someone give me an idea of what this code is supposed to be doing? Is this a good way to write this code? It looks very wordy to me.
-
I am trying to learn how to work with OpenGL. I have found several sites (OpenGL.org, Robinson's, Tao's, SharpGL's, and NeHe's) with examples to download and source code to compile. Nothing seems to work. The source code ZIPs often include Makefiles that I try running, but I still get nothing from them in VB.NET. I downloaded a compiled GLUT32.dll with the hopes of getting something to work. Several examples show how to include this as a header file in C: #include "GL/glut32.dll" With this in mind, I tried adding a reference to this DLL in my test solution with the "Add Reference" dialog box, but I get this: A reference to 'C:\WINNT\System32\glut32.dll' could not be added. This is not a valid assembly or COM component. Only assemblies with extension 'dll' and COM components can be referenced. Please make sure that the file is accessable, and that it is a valid assembly or COM component. Now, my question is two part: How do I reference this in VB.NET?, and Does anyone have any experience getting the Makefiles and examples to work? Thanks in advance for any help, ~Joe
-
Q: How do I import values to a ListView on a SubForm?
joe_pool_is replied to joe_pool_is's topic in Windows Forms
I understand the difference between passing ByVal as opposed to ByRef. As to which Me.lsvLayers is, I would have to guess ByRef. How would I test this theory? (BTW: new to VB) I've spend a couple of days trying to figure this out on my own before replying again, but your answer has only left me more confused. If one version of my program has ByRef variables and another has ByVal variables, what prevents assigning one's values to another? Why is this in place? -
I am having a problem with ListViews. Here are the specifics of my problem: Objective: Pop up ShowLayers dialog box to allow input of new layers into ShowLayers.lsvLayers listbox. When the ShowLayers form is closed, the values in ShowLayers.lsvLayers save to Form1.lsvLayers (the main form). Problem: When I call the ShowLayers dialog box again from Form1, I don't know the correct way to get the Form1.lsvLayers values back into my ShowLayers.lsvLayers listbox. Please help. First Attempt: Private Sub frmShowLayers_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' // Load any existing layers... Me.lsvLayers = Form1.lsvLayers End Sub Problem with code above: The imported layers do not show up on ShowLayers.lsvLayers listbox, and any other layers added to the listbox do not show up either. However, ShowLayers.lsvLayers.Count is correct! Second Attempt: Private Sub frmShowLayers_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' // Load any existing layers... Dim li As ListViewItem If Form1.lsvLayers.Items.Count > 0 Then For Each li In Form1.lsvLayers.Items lsvLayers.Items.Add(li) Next End If End Sub Problem with above code: Runtime gives me the Message: An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll Additional information: Cannot add or insert the item 'Layer01' in more than one place. You must first remove it from its current location or clone it. Calling the form is done via: dim objShow as New frmShow objShow.ShowDialog How would I remove the item if the form has been created from New?
-
This didn't work for me. Here is what I typed in: Private Sub Delete_Layer(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click (lsvLayers.SelectedIndices(0)) Dim lviLayer As ListViewItem Dim lviSelectedLayer As ListView.SelectedListViewItemCollection = lsvLayers.SelectedItems For Each lviLayer In lviSelectedLayer lsvLayers.Items.Remove(lviLayer) Next End Sub When I click my Delete key, the entire form closes. I have not even had a chance to save the data yet. Has anyone else experienced this? What is wrong?