| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| Senior Member Join Date: Apr 2006 Location: Houston, TX
Posts: 2,795
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Passing strings from one Form to another in Visual Basic Express 2008? I am using a TextBox control on one form to accept a directory name and trying to use it on a second form to find the number of files in that directory (filecnt = My.Computer.FileSystem.GetFiles(Form1.txtLocallyAr chivedJpg). I receive the following error whenever I try and use the directory entered in the TextBox “Value of type 'System.Windows.Forms.TextBox' cannot be converted to 'String'” How can I get rid of this error? |
| | |
| | #2 (permalink) |
| Domains my Dominion Join Date: Aug 2005 Location: Web 1.0
Posts: 9,558
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | It would be good that you post some code. Assuming that in the second form you already have a reference set to Form1 you could get the value of the string entered in the textbox like this (in Form2) Code: filecnt = Form1.txtDirectory.Text ????: NamePros.com http://www.namepros.com/programming/638337-passing-strings-one-form-another-visual.html A better way would consist in passing the string as a parameter to Form2 using Overload methods. Example: How To Pass Data Between Forms in VB.NET
__________________ NameNewsletter.com - free lists of available domain names ZoneFiles.net (beta) - ccTLD and gTLD droplists |
| | |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |