ygermain's Q&A profile
Visual C# Q: Remove an instance of a class from an ArrayList
Hello everybody. Here is the code ArrayList ar = new ArrayList(); ar.Add(new TileInfo("picture1",10)); ar.Add(new TileInfo("picture1", 20)); ar.Add(new TileInfo("picture1", 30)); ar.Add(new TileInfo("picture1", 40)); foreach (TileInfo o in ar) { listBox1.Items.Add(o.Path + " " + o.AvgColor); } listBox1.Items.Add(ar.Count); TileInfo k = new TileInfo("picture1", 10); ar.Remove(ar.IndexOf(k)); foreach (TileInfo o in ar) { listBox1.Items.Add(o.Path + " " + o.AvgColor); } listBox1.Items.Add(ar.Count); My question is: Why do I still get the same output even tho ...Show All
.NET Development date in the sql query
I have an access db with two short date fields and in my vb.net application I need to display in a dgw the data between two chosed values. Every time I try the "Data type mismatch in criteria expression" appears. I use two Datatimepicker formated as Short. In the database the field are also formated as Short Date. What could be the reason for that Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim con As OleDb.OleDbConnection = New OleDb.OleDbConnection("Provider = Microsoft.Jet.OleDb.4.0;Data Source=C:\Maint.mdb") Dim cmd As New OleDb.OleDbCommand Dim cmda As OleDb.OleDbDataAdapter Dim dset As New DataSet 'Dim cb As OleDbCom ...Show All
Windows Forms Fly over issue of modal dialog forms over other applications
I am doing a project in .NET. I have three forms say A,B,C. Form A is a mdicontainer. Form C is the modal dialog form and opens on pressing a button in form B.Now I run the application and open form C. With the application is running, I switch to some other applications like Iexplorer and then I switch back to the running application. My problem is when I switch back, the form C instead of opening inside Form A like a child form, appears as a single form over the Iexplorer itself. This fly over problem of forms is seen in all modules where child forms are declared as modal dialog forms. So anyone with any idea to solve the problem, please help. Thanks for the reply. But I am passing Form B as a paramete ...Show All
Windows Forms FormBorderStyle question
I wanted to get rid of any frame around the form and set this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; Unfortunately, it made the form immobile as I can see. How to make it moving across the screen if I want to do it Thanks. Try using the following code snippet: private const int WM_NCLBUTTONDOWN = 0xA1; private const int HTCAPTION = 0x2; [ DllImport( "user32.dll" ) ] public static extern bool ReleaseCapture(); [ DllImport( "user32.dll" ) ] public static extern int SendMessage( IntPtr hWnd, int Msg, int wParam, int lParam ); private void Form1_MouseDown( object sender, MouseEventArgs e ) { if ( e.Button == MouseButtons.Left ) { ReleaseCapture(); SendMessage( Handle, WM_NCLBUT ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Setting texture wrap mode for SpriteBatch
I can't find any means of settings texture wrap mode except by using an shader which has no effect on SpriteBatch. Also I couldn't find a means of declaring a custom vertex def with transormed coordinates but I admit to not looking real hard for that one yet. If I could that then I could just write my own sprite engine with full effect support. I read a post suggesting effects for SpriteBatches in the release version and I would like to second that. That would solve this little wrap problem real quick like. Other than that XNA has been a good experience so far. Still just a few days into it. I'm porting a long running and ever evolving 3D puzzle/action game from vc++ and with the exception of a few structural changes in the code its bee ...Show All
Visual C# Writing a 16-bit grayscale image
I have a byte array containing pixel values for a 16bpp grayscale image. I need a solution for converting said array to a bitmap image. So far I've come up with this: internal static Image imageFromArray(byte[] array) { const int WIDTH = 1472; int height = (array.Length) / WIDTH / 2; Bitmap bitmap = new Bitmap(1472, height, PixelFormat.Format16bppGrayScale); for (int x = 0; x < height; x++) for (int y = 0; y < WIDTH; y++) bitmap.SetPixel(x, y, (Color)array[(y * 1472 + x) * 2]); Image image = bitmap; return image; } But there is an error because I can't cast the byte as a color. So my question is, how do I actually translate my pixel data from the byte[] to the bitmap Is there a better way to do t ...Show All
Visual C# Convert UInt16[] to Byte[]
I want to send data to a stream as a byte array. So I neet to convert my structure to an array of bytes. I have been using RawSerialize from http://www.vsj.co.uk/articles/display.asp id=501 however it fails when I pass in a array UInt16[]. So I am converting every field of the struct individually. Then I will have to concatenate the Byte[] somehow (still to figure the best way to do that) However, I still have a problem of converting the UInt16[] to Byte[]. Any thoughts The only thought I have is than unsigned ints are not CTS compliant, try to cast it to another type. anyway you may try with the BinaryWriter Class: It writes primitive types in binary to a stream and supports writing stri ...Show All
.NET Development MSIL to native code ... is posible with NGEN?
Hello! I find the Native Image Generator , and i want ask if this tool can convert MSIL code to win32 native code. Somebody use it What results I read that is for avoid de JIT work each time but ... can I create a native and redistributable win32 exe with it I don't like send MSIL exes to my clients ... y can buy a obfuscator but ... i prefer something more ... closed :P Thanks in advance. Regards. humm ... thanks. I don't understand why Microsoft don't provide some tool for protect our work, and i must spend my money in a expensive obfuscator solution of third party :( . However obfuscation isn't a real solution, only try to hide parts of MSIL code. Yesterday i view a decompiler , than take MSIL code and give you C# o VB.NET ...Show All
Visual Studio Express Editions Combining Express Editions into one IDE or Solution Explorer
I've downloaded various express editions and have installed them. Each has an individual IDE. I'd prefer to be able to click on one IDE to be able to use the different languages or tools. I have VB, VC++, and SQL Server. I am asking how can I put these three together instead of having to choose between three different programs to launch their respective IDE's. Thank you for any help. Unforunately, integrated functionality is only available in VS Std or above. The Express SKUs are intended to be separate from each other. If you want that feature, you will have to upgrade Visual Studio. ...Show All
Visual Studio Team System ...uses unapproved generic type System.Collections.Generic.Dictionary`2
Please forgive me if this has been answered elsewhere, I was not able to find it anywhere. I'm using a System.Collections.Generic.Dictionary<> object in my code and FxCop is complaining, saying it should be replaced "with an approved type to avoid unnecessary JIT compilation for NGEN'ed assemblies." The help link in the rule ( http://fxcop/docs/rules.aspx version=v1.35&url=/MSInternal/UseApprovedGenericsForPrecompiledAssemblies.html ) does not give any info. What is the problem with using this generic collection, and what is the resolution ...Show All
Visual Studio 2008 (Pre-release) Demo III: Offline Application – WebService
Hello all, The N-Tier demo has finally arrived. This demo shows you how to take the server side code, basically the ServerSyncProvider along with all SyncAdapters that we build in the last demo, and expose it as a web service. On the client side, you generate a web service proxy and build a thin wrapper around it to be able to plug it into the sync agent. These steps and more are described in the accompanying readme.txt file. For more details and to download the project please visit my blog at: http://blogs.msdn.com/synchronizer/ Download sample: http://blogs.msdn.com/synchronizer/attachment/1554160.ashx Hi... could someone tell me where i can find the Microsoft.Synchronization.Data and Microsoft.Synchronization.Data.Client ...Show All
Visual C++ Numerical recipes in C++ Book
Hi all, I have question about Numerical recipes in C++ book and Example book. Is it worth to buy it those books, and are someone know good book for FFT analysis Thanks in advance. It's a good book in general for cookie cutter algorithms, however I would definitely look into second opinions for most algorithms in the book before you implement them. Numerous algorithms in the Numerical Recipies books have been shown to be either inefficient or just plain wrong, but for the most part it's a rather effective reference. Personally I would recommend sticking with the 'Numerical Recipies in C' book and steering clear of the C++ edition. The algorithms and mathematical background in both of them are virtually the ...Show All
SQL Server Size of the cube
Hi, Can anyone please let me know how can I get the size of my cube. I need to check out the disk space occupied by the cube. Thanks Hi, I have already processed my cube and I need to know size occupied by cube on disk. Its MOLAP cube. Does Metadata tab in Analysis manager shows proper cube size or do I need to do anything else ...Show All
Visual C# problem with datasets for reports.
Hi, I've recently testing the Microsoft report viewer and Microsofts reports and I discover some problems that I don't know how to solve I tested some datasets each one made with a diferent database (using always the same report), but the problem is that after I created one dataset and succesfull tested it, I deleted the Dataset and objects created and started over with another.... after that (when I feel confident enough) I started to build the report I was really going to use... but.. .BUT when I was going to set the Grid Data Set I realized that the name of the older datasets still exists but they DO NOT exists enywhere else in the project and I don't know how to get rid of those options. I even search throuh all the project fot the nam ...Show All
Smart Device Development NMD_UI sample not working
Hi all, After installing the NMD packet with all updates/rollups I've tried to build a NMD platform as described in the eHowTo from Mike Hall's weblog. Unfortunatelly there is no NMD entry in the Platform Builder wizard after the NMD install. Even after installing all the tools again (WinCE/PB) with all updates the entry is not visible. Does anyone know how to procees in order to activate this item Then I've tried to compile the NMD_UI sample by hand. After hours of searching for dependencies I've succeeded to start it. Again, bad lack: the app is not running cause is not finding some registry entries/strings etc. I need some help in order to be able to build/run this sample. Thanks, Cosmin Hi Cosmin I suspect you did not instal ...Show All
