Jump to content
Xtreme .Net Talk

Bucky

*Experts*
  • Posts

    803
  • Joined

  • Last visited

Everything posted by Bucky

  1. Wow, it's been a long time since I've visited this forum. I'm having some trouble filling an empty DataSet from an Access database. Here's the code (I intentionally changed the path in the connection string): private DataSet GetData() { OleDbConnection connection = new OleDbConnection(@"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Data Source='Data path here';Provider='Microsoft.Jet.OLEDB.4.0';"); OleDbDataAdapter adapter = new OleDbDataAdapter(GetSql(), connection); DataSet data = new DataSet(); connection.Open(); adapter.Fill(data); connection.Close(); return data; } GetSql() returns a valid SQL string (I tested it out in Access), and a DataTable is created in the DataSet with the correct columns, but no rows are added to it. adapter.Fill() returns 0, and data.Tables[0].Rows.Count is also 0. There should be 1000+ records in there. What could be wrong? Thanks.
  2. Ah, I see your dilema. The way you're handling form variables is probably in the VB6 style, but the name of the game has changed in VB.NET. You need to pass an initialized instance of your first form to your method. For example, to access Form1.TextBox1 from Moo(), I need to pass the form as a parameter. ' Your method in some other module: Public Sub Moo(callingForm As Form1) callingForm.TextBox1.Text = "Whatever" End Sub ' And on Form1: SomeOtherClass.Moo(Me) I hate to plug, but here's a tutorial on passing form instances between each other.
  3. I think I've got it: In design mode, click the "Build" menu, then click "Configuration Manager..." and make sure all your projects are checked under the "Build" column. If this doesn't solve the problem... what menu item or key command are you presently using to run your applications that causes this message to appear?
  4. You don't need to make the control "shared"... this means something totally different than how you're using it. Just make the control Public. You can change this scope in design view under the property "Modifiers."
  5. It's much more difficult than it may seem. Here's a VB6 solution.
  6. For a cross-language solution, you can also use the static methods of the Convert class (i.e. Convert.ToInt32(), in this case).
  7. The parameters of the launched application are stored in the args[] array. So, args[0] would hold the first parameter, args[1] would be the second, and so on. All you need to do is to add code in the Sub Main (before showing the form) that reads these parameters and does what it needs to do. static void Main(string [] args) { if (args.Length > 0) { // check for parameters if (args[0] = "foo") { // check the first parameter DoSomethingHere(); // do whatever } } // The rest of Main is here }
  8. Perhaps if you placed the two swapped lines of codes inside a separate subroutine, you could then call this method from InitiailizeComponent() without the IDE replacing it. Actually, you might only need to include the second line of the two; just make sure it comes at the end...
  9. ROFL! Taken right out of the mouth of Dave Barry! :D
  10. I don't mean to sound cold-hearted (we experienced Bob many years ago), but I don't understand why anyone would bother with a flimsy balloon-frame building when it's being built in Florida, the Hurricane Capital of the World. Geodesic Domes are extremely strong, they look cool, and there is tons of room on the inside for room arrangements (since there need not be any supporting walls to hold up the roof like in a conventional home; the roof holds itself up). When Bob hit us, a tree fell on our dome home. It was a good-sized pine tree, at that, and there was no damage whatsoever. Is it any wonder that radar domes on Antarctica (which has arguably the harshest climates on the planet, with 200+ MPH winds) are geodesic domes? I feel for you guys down there, but a little common sense goes a long way in such a climate. Just my two cents.
  11. How about Form.ActiveForm?
  12. The problem is that the string is returned not as a return value of the SendMessage method, but as one of its parameters. Also I think your length is too large if the method is returning 0 for a response. Dim sResult As String SendMessage(x, WM_GETTEXT, 10000, sResult) TextBox1.Text = sResult
  13. Personally, I use TweakUI, which has an option for auto-logon (under the "Logon" tab). It's not the most secure solution, but it's what you're looking for.
  14. In a way, yes. If you give the control an "id" attribute, then you can declare a variable of type HtmlInputFile with the same name, and then interact with that. So, this would be in your HTML: <input type = "file" id = "fileInput" runat = "server"> And this would be in your code-behind (assuming you're using one): Protected fileInput As HtmlInputFile See MSDN for an example.
  15. Congrats! :) Thanks for sharing your code.
  16. How about sending WM_GETTEXT? Pass the string to receive the text into the lParam, and the maximum length (choose something large) of the string in wParam.
  17. Hmmm, well according to this site, this might work for you: SendMessage(x, WM_CHAR, 13, 1835009)
  18. Yes, it is a different way of thinking, but not nearly as difficult as classic ASP (in terms of transitioning). VBScript... ick
  19. In that case, try this (find the value of the constants in the API text viewer): SendMessage(x, WM_KEYDOWN, 13, 1) SendMessage(x, WM_KEYUP, 13, 1) 13 is the code for the return key (I believe) and the 1 is a flag to send the key only once. See more here.
  20. You're close; use + (or & in VB) to concatenate the strings: Data Source=Request.PhysicalApplicationPath &"database\Nwind.mdb"
  21. You don't do anything to set it up; it's a property. Just make sure that all your physical paths you use (to find the database file and such) contain this property (or some form of it).
  22. Yeah, if you're just going to split by a single character, like in my example, you could just use the String.Split() method: string[] words; string text = "This is a test, yo."; words = text.Split(' '); // In VB.NET this would be: words = text.Split(" "c)
  23. I believe that Form.SetStyle (it's a protected method) is what you're looking for (along with the ControlStyles.UserPaint, of course). Check here.
  24. Send the return characters along with your "TEST", like so: Dim strText As String = "TEST" + Environment.NewLine If that does not work, try sending the Environment.NewLine string in a second call to SendMessage (after sending the "TEST").
  25. Ooh! Ooh! I know this one! *raises his hand* Request.PhysicalApplicationPath (I think that Server.MapPath("") would work, also) :)
×
×
  • Create New...