Jump to content
Xtreme .Net Talk

3xodus

Avatar/Signature
  • Posts

    47
  • Joined

  • Last visited

Everything posted by 3xodus

  1. Argh - sorry about this PlausiblyDamp - I *think* you're right on the money. I was combining two different thoughts when I tried this out - it's been a hell of a day :), I'll try again with a clearer head in a few minutes. Thankyou very much ;)
  2. It is almost, and I believe I've tried it this way at some point. The problem I have here (my fault - I didn't mention this) is that if I have a function in ClassB or ClassC (and ONLY ClassB OR ClassC) then the ClassA that I'm left with doesn't have access to it - I can only use this as an instance of ClassA with ClassB or ClassC overriden functions - hopefully of course I'm missing something. In the C++ version as the ClassA pointer was pointing to an instance of, for example, a ClassB instance, I could access public functions within ClassB. An example might be, if I were to change the existing switch statement: [color=#0600ff]switch[/color][color=#000000]([/color]someInteger[color=#000000])[/color] [color=#000000]{[/color] [color=#0600ff]case[/color] [color=#ff0000]1[/color]: p_classA = [url="http://www.google.com/search?q=new+msdn.microsoft.com"][color=#008000]new[/color][/url] ClassB[color=#000000]([/color][color=#000000])[/color]; p_classA->writeLetterB(); [color=#0600ff]break[/color]; [color=#0600ff]case[/color] [color=#ff0000]2[/color]: p_classA = [url="http://www.google.com/search?q=new+msdn.microsoft.com"][color=#008000]new[/color][/url] ClassC[color=#000000]([/color][color=#000000])[/color]; p_classA->writeLetterC(); [color=#0600ff]break[/color]; [color=#000000]} if(p_classA is ClassB) p_classA->writeLetterB(); else p_classA->writeLetterC(); [/color]
  3. I have some C++ code that I wrote while at Uni (I'm in a year work placement at the minute) that's along the lines of: ClassA* p_classA; ClassB* p_classB; ClassC* p_classC; switch(someInteger) { case 1: p_classB = new ClassB; p_classA = p_classB; break; case 2: p_classC = new ClassB; p_classA = p_classC; break; (.. and so on..) } p_classA->Something(); I came back to look at it as it does what I want to do at work in C# - that is to work with either ClassB or ClassC without knowing which, via a pointer of ClassA (which both ClassB and ClassC derive from), upcasted from a ClassB or C instance. Is this even possible now in C#? I've read a little about how C#'s pointers differ from C++, and it seems not. All 3 classes are will be my own, but would contain managed properties such as strings and integers. Is there another way I can approach this? Now sure how well I've explained what I'm trying to do either. Thanks,
  4. Joe Mamma: Hmm, I already have the modifiers on the controls I wanted to access set to Public. I didn't know that was a bad thing but it didn't work anyway, so I'll set them back to private. Your other solution does seem nice, but I don't think I can use that - on my Form1 there are several images and several labels which can be modified from Form2. Form2 has controls to move and resize images, and change the font, forecolor and textalignment of labels. This is why I was hoping to be able to just use firstForm.lblLabel.Location = new Point(x,y) and so on to change properties. Out of curiosity, what is the disadvantage / bad reasons for having the modifier property "public"? Cags: That's what I've read yes. I've seen one or two VB.NET example on these forums about using constructors, but I can't make sense of how to use them (where is the constructor? what code can I add to it/what are good times to use the constructor? - that's what I'm about to look up though) Maybe learning about constructors would be a good thing (I'm about to search MSDN) but it really seems to me that it would be overkill for this purpose. I just don't understand why it's so easy to do SecondForm frmTwo = new SecondForm(); frmTwo.txtBox.Text = "whatever"; but when I want to access properties on the first form from the second one, I can't use the same method. It just seems odd to me :| By the way, I just tried on Form2, Form frm = this.Owner;, and with that I can now access Form1's properties, but none of it's controls (so I can do frm.Text = "test"; but not frm.txtBox.Text = "test";. ) Am I on the right lines there or is it wishful thinking? Thanks guys :)
  5. *sigh* I'm almost embarrased to ask. This is in C# for Visual Studio 2005 by the way. I've spent a few hours last night and literally *hours* trying to figure this out today, and can't for the life of me get it to work. There's a fair amount of threads on this already, but the majority deal with accessing controls on Form2 from Form1, which I can do fine. What I'm having problems with is accessing properties on Form1 from Form2. That first thing I thought was just: Form1 firstform = new Form1(); firstForm.txtBox.Text = "test"; But it dosent work, and as I understand it the reason it dosent work is that I've created another instance of Form1 and I'm accessing *that*, not the existing one. The only other solutions I've found were for VB .NET and involved adding code to the 'constructor'. I couldn't find any information about how to get this to work for C#, is that what I should be looking for? Any help appreciated, thankyou :)
  6. Wow, that's a shame. I kindof expected it, since I've seen nothing about it elsewhere either. I guess I'll make my own version. Thanks anyway guys! :)
  7. Hi, Is there any way I can limit the fonts shown in the fontDialog component to specific fonts? I like being back to set label.Font = fontDialog.Font; so I'd like to use the fontDialog if possible rather than creating my own, but I can only allow certain fonts to be shown. I haven't been able to find this anywhere, does anyone know if it's possible? Thanks :)
  8. If you just want to access for example the second column, you can do something like: listView1.Items[0].SubItems[1].Text = "Whatever"; or depending on your situation, you could use the Key, which you would add at the same time as adding the item. Then to access the second column you could do something like: listView1.Items["ItemKey"].SubItems[1].Text = "New Text"; I'm currently writing a UI for an online gaming service, and I'm showing the users ping next to their username in a listView. Whenever I add a user to the listview, I also add their username as the key, which makes it easy for me to update their ping (and other details) whenever I want, by doing listView.Items[string UserName].SubItems.blah... Hope this makes sense :)
  9. Hi, This is C#, but the idea is of course the same for VB .NET or whatever language you use: listView1.Items.Add("Item 1").SubItems.Add("SubItem 1"); Will add "Item 1" to the first column, and "SubItem 1" to the second column. You can add .SubItems.Add.. etc etc for as many columns as you have :)
  10. Thanks for your thoughts, though my treeview is more than wide enough. The treeview's width is 197, much wider than any of the nodes. I've tested with nodes 1 character in length, and the result is the same. I am now fairly sure that setting the .Scrollable property to true at runtime just adds both scrollbars regardless of the contents of the treeview. Since I'm using C# 2005 beta 2, I'm hoping that the option is added in the final release to choose scrollbars (maybe boolean treeView.HScrollable and treeView.VScrollable) though it's not such a big deal.
  11. Hi again :) I've spent too much time reading around for information on this, and trying for myself.. I know it's probably something obvious that I'm not going to find.. I have a TreeView that scrolls vertically due to the amount of nodes, but *dosen't* scroll horizontally as there are no nodes wide enough to need it. However as a part of my app I have to set TreeView.Scrollable = false;, and later on, back to = true;. When Scrollable = true again, there's a vertical and horizontal scrollbar. None of the nodes have changed, they're all still far from needing horizontal scrolling. It seems that setting the .Scrollable property to true at runtime just automatically adds both scrollbars. As a side not, the horizontal scrollbar won't even actually scroll. Just to show how pointless it is that it even appears :) Is it possible to get rid of the horizontal, and leave the vertical one there? I can't see any properties for this, but I'm hoping there's something... Thanks for any info guys ;) [EDIT @ 19th July, 21:30] I've still not found anything on this unfortunately, however my problem is solved as I've found an alternative way of doing it... I'm still interested to see if this is possible though, if anyone knows.
  12. penfold69 - that's one Idea I was considering, though I didn't get round to trying it. I wanted to do it through code if I could. Joe Mamma that is perfect, thanks. Can't believe I din't think of .Parent :( Thankyou both :)
  13. Hi, I'm writing a user interface for an online gaming system (found at TeamXLink.co.uk - it allows you to play XBox, PlayStation 2, Gamecube, PSP and Nontendo DS games online). The XLink engine, which does all the work tunneling packets over the Internet) is seperate from the UI, so basically you can write a UI in any language you like, so long as you communicate between the UI and engine correctly. Anyway, onto my problem - I have a treeview populated with a list of online users (tvChatUsers) and a tabControl (tabPrivateMessages). I want to add a new tab to the tabControl when a user is double clicked on, the tab should contain a button, richTextBox and a textBox. I have the following code to add a tab: TabPage PMtab = new TabPage(e.Node.Text.ToString()); tabChat.TabPages.Add(PMtab); (e.Node.Text contains the users name) That works fine, and adds a tabPage to the tabControl with the users name as it's .Text property. The part I'm having a problem with is adding a button and textBox to the tabPage container. I tried: TabPage PMtab = new TabPage(e.Node.Text.ToString()); Button PMbutton = new Button(); PMbutton.Text = "Send"; PMtab.Container.Add(PMbutton); tabChat.TabPages.Add(PMtab); But got the error "Use the new keyword to add an object instance." on the second to last line. I don't see how to use the new keyword here - I thought my first two lines were creating the object instances? Also is it possible to name the button and textBox? - I was hoping to include the value at e.Node.Text in the name so that I know which button is being clicked - which user to send the message to. Thankyou for any suggestions ro links :)
  14. Hi I believe this is the site ThePentiumGuy was refering to, though I've never used it. http://squishyweb.com/ware/products.asp?q=squishysyntax
  15. GMail seems quite picky - I send my work to and from college in .zips 3 times a week, every week and I've not had a problem at all.. But I have a few friends who can't send their work in zips and have to change the extension as Denaes said.
  16. If anyone's interested in this, I read this a few days ago. Quite interesting to me, but I've not tried it at all..
  17. Radio buttons are group by the container they're in. So you can put radio buttons from question one in a different container (panel, group box or similar might be good for what you're doing) from question 2 (and so on for question 3, 4 etc.), and you'll be good to go, I think. Hope that helps :)
  18. Yes I did, every time I tried to install I went through the entire list, rebooted, and tried again. I'm having network problems at the moment, but as soon as that's sorted, I'll try to install the C# beta 2 on my second machine, which is recently formatted and has no Visual Studio / .NET Framework related software installed whatsoever. If that does work, then I'll backup my boot drive on the main PC and format -> reinstall Windows. It's the only thing I can think of, since I can't find anyone else with this problem, and no information about it on MSDN. As much as I liked beta 1 and would like to see beta 2, if I can't install beta 2 after formatting and reinstalling Windows I think I'll just wait untill I can buy the final version. Thanks anyway :)
  19. Hi, I've had a quick look around MSDN and the Visual Studio 2005 sections, but haven't found any information on this yet, but I have an error with C# 2005 Express beta 2. This is the error: http://www.3xodus.net/images/vs2005beta2error.JPG I followed the instructions on perparing the installation if you had pre-beta 2 products installed on your PC to the letter. The error occurs (as you may have guessed from the error) when I try to load a form in design mode. Does anyone have any information or suggestions? Thankyou. PS. I should also point out that I have re-installed several time, once from the web-installer, and three times from the .img which is almost 500MB - each time I followed the instructions for removing all pre-beta 2 products, re-booted, then re-installed. Edit: I guess it may be useful to add as much info as I can - I used "Daemon Tools" to mount the .img My PC: AMD Athlon64 3400, 1GB RAM My OS is Windows XP Proffesional VS 2003 and C# 2005 beta 1 both worked flawlessly. and for what it's worth, the installation seemed to work fine. No errors there at least.
  20. Just fyi, I noticed this posted on Jurgen Postelmans's blog on MSDN (dated today, 17th April: [link]
  21. Ah thanks DiverDan, I'll give it a shot ina few minutes. To be honest, I ignored that menu-item as I assumed it would do the same as rightclicking the toolbox and Add/Remove Items, and therefore I'd have to use the DLL. Thanks for the fast response too ;) - 3xodus.
  22. Hi, I've just started looking into writing my own controls - I just ran through a tutorial, downloaded a few samples, played around a bit etc, and I was wondering... Is there any way to use my new controls without distributing the .dll? A project I'm working on is small and will be disributed via my website - probably less than 50 people will ever use it. I want to distribute it as a single executable, which I can do if I don't use my control it seems. Is there a way to just use my controls Class (one .cs file) to use my control, rather than using the .dll which I would have to distribute? Thankyou :)
  23. I'm 17 and I've been programming on and off since I started in QBasic when I was 11. My Dad showed me QBasic and as I remember I only learned the basics (using variables, conditional statements and such). Then I got a cut-down version of Delphi 4 on a cover disk which got me into Windows writing GUI applications. I heard about VB on the internet, and borrowed VB6.0 from a friend. Since then I've pretty much been VB only - though I enjoy playing around with (extremely simple) ASM using the RadASM IDE, and C++ .NET. I'm also trying to learn C#, though VB.NET is my main focus. So altogether 6 years, but only 2 serious years of effort. Not that it shows.
  24. Hi Denaes, I read that Beta 2 would be released towards the end of March, and the final product should be expected around the end of summer. I don't know the source of that information, but I suppose we'll find out about beta 2 by the end of this month. As far as I know, there's no word on this from Microsoft (at least not publicly).
×
×
  • Create New...