Jump to content
Xtreme .Net Talk

Nerseus

*Experts*
  • Posts

    2607
  • Joined

  • Last visited

Everything posted by Nerseus

  1. (I hate open questions): If you really wanted to use a Listbox with "tabs", you'd have to use the Win API SendMessage. Something like this in C#: public class Form1 : Form { // Declare the DLL function at the top of a class [DllImport("user32", EntryPoint="SendMessage")] private static extern int SendMessageTabStops(int handle, int msg, int tabCount, int[] tabStops); private const int LB_SETTABSTOPS = 0x192; private void SetTabStops() { listBox1.Items.Add("dan\tbob\tMe"); listBox1.Items.Add("bob\tbob\tHim"); listBox1.Items.Add("hagatha\tbob\tHer"); int[] tabStops = new int[] {0, 50, 100}; SendMessageTabStops(listBox1.Handle.ToInt32(), LB_SETTABSTOPS, tabStops.Length, tabStops); } } -nerseus
  2. Should just be "&attachment=...". I tried this here and got the message "The command line argument is not valid. Verify the switch you are using.". I tried surrounding the file in double quotes, single quotes (no errors but no attachment), and referencing a hard-coded path like C:\ and a shared drive. I either got the above message or I got no attachment. Searching MSDN found the following article. Unfortunately, the URL:MailTo on my machine was exactly what they said it should be. http://support.microsoft.com/default.aspx?scid=kb;en-us;312346 I also tried making Outlook Express the default mail program and got basically the same results. Not sure what's wrong :) -nerseus
  3. Haven't tried this in awhile, but I think you need to use a temp table. Try something like: CREATE TABLE #temp ([iD] int) exec('insert into #temp select ' + @colname + ' FROM myTable where user_id = 100') SELECT [iD] FROM #temp -nerseus
  4. While you can surround the field name and put almost anything in there for a table (or column) name, the should factor might stop you :) Why not just format the date without slashes? A well formatted date with year first allows for easy sorting as a string (if you ever wanted to show a list of backups, for example): dt.Date.ToString("yyyyMMdd") -nerseus
  5. In the window.open call (in javascript, for example) you can specify flags that determine what the new window looks like. That include flags to make it not resizable, the window size and more. I can't help much with the ASP datagrid. -ner
  6. New news: The Cure will release a new CD at the end of June (in the US, likely sooner in Europe). I *think* it will be a self-titled album - strange, as the Cure has probably close to 20 albums :) -Nerseus PS - I'm only throwing this out there since there was some interest in the Cure last time AND I can't tell anyone at work or home because they all pretty much hate the Cure. You guys become my sounding board...
  7. This is a semi-known issue with GDI+. It becomes *really* bad when you make a label bold and right aligned. I haven't heard if MS is planning on fixing it or not, but I noticed the bold/right align problem almost 2 years ago. -nerseus
  8. I thought you just used "attachment=path\filename". Haven't done this in a few years, but I think it's that simple... (maybe?) :) -nerseus
  9. You don't need to search MSDN: just use Google. If you search for "directx" it takes you right to the download page. Since you plan on learning .NET and DirectX at the same time, you'd better get *real* good at searching for information *real* fast as DirectX is a very difficult thing to learn by itself - and that's for experienced developers confortable with a language. To tips to searching for info: In google, you can include "site:website" to limit a search to a particular URL. For example, you can use the following in google: directx site:microsoft.com Another useful tool - Microsoft's area of Google: http://www.google.com/microsoft.html -nerseus
  10. I don't know if SharpDevelop does this for you automatically or not, but you need to convert the COM component into a .NET version (at least, I assume your SDK is distributed as a COM DLL). In Visual Studio, you simply add a reference to the COM component and it takes care of creating the new wrapper DLL for you. If SharpDevelop doesn't do that, you'll need to run a utility on the COM DLL to get an "interop" DLL that .NET recognizes. I can't remember the utility offhand, but it's a command line thingy :) -Nerseus
  11. @Jaco: Some might argue why almost ANY keywords are necessary. For example, why type "Then" for an "If"? Why not use C++ style curly braces to save on other typing? I think the WithEvents was an alert to the compiler that it needed to do a lot more work for that variable so that it could handle events (not to mention Visual Studio so that it could, as you pointed out, let you create an event through the drop-downs). My personal thoughts are that VB6 and below were meant to be very easy to understand and, in that regard, VB was beautiful as a language. It may not have been the fastest to type in, but it gave you a chance to make the code very easy to read (not necessarily understand, which is what the developer should be doing). Overload is a big necessity, in my opinion. It states clearly that the developer is overloading something existing versus creating a new version of the method. Stating the obvious today makes the code MUCH more readable tomorrow when you don't remember what methods are "new" and which ones are being overridden. Now why Visual Studio doesn't fill in the parens as soon as you type in "if", I don't know. I can't think of a single time when you'd type in "if" and NOT want the parens there... -Nerseus
  12. The built-in grid control is called a DataGrid. It's not very robust, but it is bindable and editable. For now, if you want anything nicer, you've got to look for one. There are many that you can buy and probably a few you can get for free (not sure if there are any though). -nerseus
  13. First, I wouldn't convert the DateTime values from the database. I'd return them as regular DateTime fields. To get the hours/minutes worked, you'll need to get the values of start and end date into DateTime variables from your dataset. You can then Subtract them and get a TimeSpan object which will show you the hours (and minutes, etc.): DateTime startDate = (DateTime)ds.Tables["TimeIn"].Rows[0]["StartTime"]; DateTime endDate = (DateTime)ds.Tables["TimeIn"].Rows[0]["EndTime"]; TimeSpan diff = endDate.Subtract(startDate); Debug.WriteLine(diff.Hours); -Nerseus
  14. Have you tried the Anchor property of the PictureBox? It should handle the resizing automagically. -nerseus
  15. The line you show is basically saying you've got no data in your dataset, hence nothing to show up for binding. I'd have to see some code in both the class the creates/returns the dataset and the class/form that calls it. Why use a public variable? If you have a separate class made to return a dataset I would think you'd just pass in the value rather than use a public variable. -nerseus
  16. From the immediate window you can use: ?ds.GetXml() where ds is the dataset. In code you can put: System.Diagnostics.Debug.WriteLine(ds.GetXml()) -Nerseus
  17. Well, the fastest is to use the Ordinal position of the column. For performance sake, I truly wouldn't worry about using ItemArray vs. the column name - I'd go with whatever is easier to understand. The only reason to NOT use the column name is if you're opposed to having such a hard-coded string in your code. It's easy to argue which is worse: a hard-coded column name or a hard-coded ordinal position. I'd much rather have the hard-coded column name, but that's just one person's opinion. In almost every scenario, I'd go with the more readable/maintainable code. Don't worry about performance on little things - wait til you have time to do performance analysis and figure out where the big problems are. If you code for performance now you'll only serve to make finding/fixing bugs hard later on. And chances are good that the code you're optimizing now (and maybe make less readable) is NOT going to be where the big bottlenecks are. -nerseus
  18. My coworkers use the task list (and most other toolbar windows) in autohide mode. They used to have a bunch of issues with Visual Studio 1.0. With the new version (VS 2003 or 1.1) they haven't seen nearly as many issues. I have NEVER had a toolbar problem in Visual Studio and I use the "pin" to keep the toolbars open (all except the Toolbox and Server Explorer, which I don't use very often). I do have an advantage of having a large monitor though, so it doesn't hurt to keep toolbars open. If you have VS 1.0, you might just have to "put up with" the locking as I doubt MS is going to release a service pack seeing as how it's going to be 2 version behind in about 6 months. Yes, that sucks... same thing happened with VB4 (VERY buggy)... -nerseus
  19. There's no need. You just add an event handler. Say your variable exposes an event named MyEvent of type System.EventHandler: // This is in form_load for example MyType var = new MyType(); var.MyEvent += new System.EventHandler(this.MyHandler); // this is outside form_load, the event handler: private void MyHandler(object sender, System.EventArgs e) { // handle var.MyEvent here. } -nerseus
  20. I think you declared your variable right, as Array. You'll have to use ToString() to convert or System.Convert.ToString() (but that's the hard way). I'd avoid CType as it's a carryover for converting from VB6. Since you already know some facts about the data you're getting back (the tablename for instance), why not use the column names instead of using ItemArray? Maybe something like: dsData = objDataAccess2.GetDataSet(mstrConnectionString, strSql, strRecordSetName) ProgramData = dsData.Tables(strRecordSetName).Rows(0).ItemArray() Dim val1 As String Dim val2 As String 'Set Form Caption val1= dsData.Tables(strRecordSetName).Rows(0)("col1") val2= dsData.Tables(strRecordSetName).Rows(0)("col2") Me.Text = val1 & " " val2 -Nerseus
  21. What are you matching against? If it's a Database, sounds like you'd want to use the LIKE word in your query. If this is a text search across files then... well, why would you do that?? Torture :) -nerseus
  22. I don't think I've seen any weird things happening with the Task List on a failed build. Does the task list just NOT show up, or not show the compile errors? As a default, you can press Ctrl-Alt-K to bring up the task list if it's just hidden. If it's not showing the compile errors, maybe it's in the wrong "mode". If you right click the task list and select "Show Tasks" then select "Build Errors". I like to use "Show All" because it will show my "TODO" comments as well as a few custom ones I added "// DJ ..." (yes, my initials). -ner
  23. Whoops - forgot to answer (ask) about your first issue: the Text property not showing a value. You said in Break mode the txtID.Text property showed empty string but when the form loads up you see the value (because it's bound)? When did you set the breakpoint? Make sure it's after the binding (d'oh!) and after the DataSet is filled. If that's what you were doing then I'm not sure why the Textbox wouldn't have a value in its Text property. Certain controls, such as the DateTimePicker, have a Text property but you usually use a different one, such as the Value property. But on a Textbox all you need is the Text property. -Nerseus
  24. Sounds like you've either got no data in your dataset or however you're binding is off - both to the textboxes and the grid. I'd first verify that the DataSet has the data you expect. The simplest way is to print out the value of ds.GetXml(). You can also write the DataSet to disk with ds.WriteXml(). Let us know if it has data but the binding's not working. Let us know what code you've got for the binding, too, so we can help tweak it (if it's off). -ner
  25. I wouldn't use the Textbox at all. Use the DataSet to drive the Radio buttons. If you need to update the radio buttons as the value in the dataset changes, then use the columnchanged event. Try something like this (just in C#, sorry): // In Form_Load or similar, setup the event. In VB I think // you put " Handles ... ColumnChanged" or something after a function ds.Tables[0].ColumnChanged += new DataColumnChangeEventHandler(Form1_ColumnChanged); // Somewhere else in the class, define the event handler: private void Form1_ColumnChanged(object sender, DataColumnChangeEventArgs e) { string fullColumnName = e.Column.Table.TableName.ToLower() + "." + e.Column.ColumnName.ToLower(); switch(fullColumnName) { case "table1.column1": if(e.ProposedValue=="Book") { RadioButton[0].Checked = true; } else if(e.ProposedValue=="Tax") { RadioButton[1].Checked = true; } else // both { RadioButton[2].Checked = true; } break; } } Of course, I hate seeing hard-coded values like 0, 1, and 2 like that. It would be much more readable to use an Enum for the 3 values. -Nerseus
×
×
  • Create New...