Mikey Stevey's Q&A profile
Visual Basic Variable in Resouce Name?
I have several images called rt_#.bmp as a resource for my app, where # is a number, -1 though 15, i was woundering if ther was a way to use a varibale to represent the # in caling for it, so i could do something like this: Dim num as integer = 12 picBox.Image = My.Resource.rt_ & num but where instead of making it equal 12, it would equal a value read from a file, but using the code i used above gives a build error so it their a way to use a variable in a resouce name You can try something like this. (And CType the return value to the appropriate datatype.) My .Resources.ResourceManager.GetObject("rt_12") ...Show All
Visual Studio 2008 (Pre-release) How to check if a Visual is visible on screen
I have an application with a lot of user interface elements. Only a subset of those elements is visible at the same time. For performance reasons I want to do some cleanup operations, e.g. with an Idle thread, for elements that are currently not visible, e.g. dispose a large cached bitmap in a hidden Tab. Is there any way to check if parts of a given Visual are currently visible on screen Unfortunately not for a Visual, since it does not support layout. You would have to go down one level deeper. Anything that inherits from UIElement has an "IsVisible" dependency property which can be used. Instead of having a seperate thread that does the cleanup you could tie into the IsVisibleChanged routed event and handle the cleanup ...Show All
.NET Development converting a byte array to a string?
I have a program that acts as a server and when it receives information I would like to get all the data until a break char is given. for example the return key. The problem I am having is converting the Byte Array back to a string, it seems to only be giving me numbers. If you would like me to post my code to explain then I will :D. Looks like you're reading a chunk of 32 bytes and try to convert it to string... Yes, you should probably find out the number of bytes the Receive function will return and initialize the byte array appropriately. Andrej ...Show All
Visual Studio Express Editions "Registration benefits" email is broken
So I just got this "Thank you for registering" email from MS that has links to the Registration Benefits portal. Great, but the portal links are broken. It takes you to a login page. I login. Then it goes to a "Page Not Found" error page. Anyone else getting this The link in the source of the email is a forwarding link, not a direct link. I just want to get to the registration portal, but alas, I cannot :( Also, as an aside, the icons they suggest downloading are indeed "royalty-free", but they cost over $200 to buy. I had the same problem a while back, and did what Andreas said and that fixed my problems, so do exactly as Andreas says. The reason you have to go ...Show All
Visual C# Passing a class object or reference to a function
Hello, I would like to pass a class-object or a class-reference to a function. I seem to do not really understand object/reference handling in C#. My passing function generates a compiler error. //my class public class A{ } //my function that must be passed a class-object or class-reference public void MyPassingFunc(A a){ } //my main funtion public void MyMainFunc(){ //create class object A a = new A(); //passing object/reference to function create compile error MyPassingFunc(a); } Error 1 An object reference is required for the nonstatic field, method, or property 'MyPassingFunc(a)' Does 'a' hold a reference or an object I think a reference. What am I doing wrong regards Henk Well, let me answer my ...Show All
Visual Studio Express Editions Add numbers
Hello all, I need my program to add nine numbers together and get the some. I am using this code: Private Sub Button1_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox2.Text = Txt1.Text + txt2.Text + txt3.Text + txt4.Text + txt5.Text + txt6.Text + txt7.Text + txt8.Text + txt9.Text TextBox2.Text = TextBox2.Text / 9 End Sub It is not doing what i need it to. Without deviding, lets say all of the numbers were 100, it would write 100 tons of times. How can i fix this Both the input and output of a textbox must be a string, not a number. If you need to process a numeric input mathematically, then it must first be converted into a number, and the ...Show All
Visual C++ when I upgrading a project from vc6.0 to vc2005 ,I wonder if it is necessnary for me to add reference of those dlls to the proje
In vc2005, when using a dll or a lib in a project ,it is necessnary to add reference of that dll to the project.But when I upgrading a project from vc6.0 to vc2005 ,in the additional dependency of general option of linker of configration property, I can see all the dll and lib files.In the situation, I wonder if it is necessnary for me to add reference of those dlls to the project ,or just keep the project setting no changing I appreciate your help. A project that does not target the CLR. The terms: "managed" - targets the CLR "native" - does not target the CLR are used quite often when talking about different kinds of Visual C++ applications. ...Show All
Visual Studio Team System Team Build Conditions
Hi, I am creating a TeamBuild with a requirement that it should build the solution in both the Debug as well as Release configurations. For this I included two ConfigurationToBuild sections specifying the desired build flavors. Up till this everything is working fine; the solution is build in both the Debug and Release modes. But I have one more requirement, and it is that the Unit tests should not run against the Release build output. I have tried to use various conditions(shown below; with output) in the Target section but none of them works. Any inputs/ideas please. Condition = " '$(Configuration)' =='Debug' " //Tests are skipped in both Debug and Release Condition = " ''%(Con ...Show All
SQL Server Linked Server Problem
We migrated our production SQL Server 2000 database to a new machine and all seems to be working well except for our linked server on our SQL Server 2005 instance that points to our SQL Server 2000 database that was just moved. We get the following error when we try to query a table on the 2000 database. I have read this article in the Books online but that does not seem to apply to us ( http://msdn2.microsoft.com/en-us/library/ms175496.aspx ). OLE DB provider "SQLNCLI" for linked server "SQLPRD-DBS" returned message "Communication link failure". Msg 233, Level 16, State 1, Line 0 Named Pipes Provider: No process is on the other end of the pipe. Msg 18456, Level 14, State 1, Line 0 Login fail ...Show All
Windows Forms TableLayoutPanel Row / Column Resizing at Runtime?
Hi, Is there a way to change the row and column dimensions for a TableLayoutPanel at runtime (done at design time by clicking the little arrow and "Edit Rows and Columns" or through Properties > Rows / Columns > Collection [...]) It would be fantastic to create a table based layout that is able to change dynamically, for example making a row really small to hide it's contents when a button is clicked, and then making it large again to show them when it is clicked again. I have tried to do it like this: private void showHideLabel_Click(object sender, EventArgs e) { if (detailsInnerFlowLayoutPanel.Visible) { detailsInnerFlowLayoutPanel.Hide(); System.Windows.Forms.RowStyle small = new RowS ...Show All
Gadgets embedding and updating content
Hello, 2 questions: 1. What is the downside of embedding a web page as a gadget In my case Im trying to convert what is originally a web page into a gadget. Is there any reason why I shouldn't just embed a modified web page 2. Im trying to write a simple gadget that contains links, when clicking a link I want to change the displayed information on the gadget. Ive looked at the Quote of the Day example, but that code is a bit over my head... does anyone have an easy to comprehend example (in short I want to be able to make links that doesn't link to a new page but instead changes the information inside of the gadget) swn78 wrote: Hello, 2 questions: 1. What is the downside of embeddi ...Show All
Windows Forms progressbar while dataset is loading
I use a dataset to load around 1000 records into a DGV. How can I show a progressbar while a dataset is being loaded Ah ok, I see where your at. Well I'd suggest just looking at the backgroundworker1_DoWork() function. Thats the one that is does all the work on the background thread. Thats where you load the data into the dataset (or call a function that loads the data). While you're loading the data, just call the ReportProgress() function on the BackgroundWorker object any time you want ot update the progressbar (see the ComputeFibonacci() function for that). The call to the ReportProgress() function will trigger the ProgressChanged event on the BackgroundWorker. So in the example, an event ha ...Show All
SQL Server Any idea why OpenRowSet to open Excel file doesn't work well in SQL 2005?
Maybe it worked once, but in most time it doesn't work, query like below select top 10 * from OpenRowSet('microsoft.jet.oledb.4.0','Excel 8.0;hdr=yes;database=\\ws8\web\ablefiles\sitefiles\4000010\reibc\active.xls', 'select * from [crap2$]') I got error OLE DB provider "microsoft.jet.oledb.4.0" for linked server "(null)" returned message "Unspecified error". Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "microsoft.jet.oledb.4.0" for linked server "(null)". but the same query can run without any problem on a SQL 2000 server run on a server in the same network. Any idea Something is not righ ...Show All
Visual Studio Tools for Office Assembly location during debug differs from output folder
Hello, I'm migrating a Word 2003 shared addin to a VSTO 2005 SE Word 2007 Addin. This addin uses some xml files which should be located in the same folder as the Addin is. In the previous version I looked these files up by using the System.Reflection.Assembly.GetExecutingAssembly.Location This worked perfect, but now If I debug the project all the required files are copied to the bin\Debug folder but the System.Reflection.Assembly.GetExecutingAssembly.Location give me a location that is comparable to C:\Users\ username \AppData\Local\assembly\dl3\RT5TDQVD.CGJ\T81B2ATH.YXM\65ce212f\0dea5369_3e50c701 This folder is created on every debug and it does not contain my xml files. Who knows a solution for this problem ...Show All
Visual C++ Best practices: marking threads as answered
Just a friendly reminder to make sure you mark threads as answered if 1. you are reasonably certain that the thread has been answered, or at least the original poster is getting sufficient attention, 2. the thread has gone stale, or 3. the post has been deemed off-topic. The reason for this is to encourage others to read a thread that still needs resolution. Thanks. Brian Anyone who can't find an answer can make a new post. It's better to keep the forum up-to-date than to expect people to go back 10 pages in search of things to answer. Maybe a good suggestion is to have a new category called "expired" (yellow). If this were to happen, however, chances are that these threa ...Show All
