536 Posted Topics
Re: You just need to swap the order of the test in your main form. [CODE] if (Globalvar.pcheck == "n") { LogInScreen newMDIChild = new LogInScreen(); newMDIChild.MdiParent = this; newMDIChild.Show(); } if (Globalvar.pcheck == "y") { AdminForm newMDIChild = new AdminForm(); newMDIChild.MdiParent = this; newMDIChild.Show(); } [/CODE] | |
Re: These link might also be helpful. (They relate to Windows Forms application not WPF but the principles are the same.) [URL="http://msdn.microsoft.com/en-us/library/fbk67b6z.aspx"]MSDN How to:Bind Data to the Windows Forms DataGridView Control[/URL] (With lots more links to further reading) [URL="http://stackoverflow.com/questions/598669/c-visual-studio-correlation-between-database-dataset-binding-source"]Correlation between database, dataset, binding source[/URL] Note: Since your DB is SQL CE … | |
Re: The error message is quite clear. The compiler does not allow pointers to managed types. All native objects are managed in .Net. Are you sure you need a pointer? What are you trying to do? | |
Re: You do not need to store every key the user types; the TextBox will do that for you. Just use the [I]Text [/I]property when you need it. If you use an [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx"]OpenFileDialog[/URL] the user can select the source file. If you use a [URL="http://msdn.microsoft.com/en-us/library/system.windows.forms.folderbrowserdialog.aspx"]FolderBrowserDialog[/URL] the user can select a destination … | |
Re: This is a common problem with multi-threading. It is only possible to change the properties of Components and Controls from the UI thread. To change them from another thread, you must [I]Invoke [/I]a method that does the change for you. However, for what you are doing I do not think … | |
Re: You will find lot of solutions for this [URL="http://lmgtfy.com/?q=CLR+has+been+unable+to+transition+from+COM+context"]here[/URL]. | |
Re: @Walid86 your routines are drawing the image on to itself. This [iCODE]Graphics gr = Graphics.FromImage(loadedImage)[/iCODE] gets a Graphics object that draws on to the image. This [iCODE]gr.DrawImage(loadedImage, ...);[/iCODE] draws loadedImage on to that Graphics object (i.e. loadedImage). Neither of these operations change the size of loadedImage so its bounds remain … | |
Re: How are you thinking to get the value from the user? | |
Re: In MS SQL [I]Date[/I] is a keyword. Not sure about MySQL but if it is the same then either: 1) Change your column name to something else. or 2) Put [] around the column name in you command strings. E.G [iCODE]UPDATE WaynokaLogger SET [COLOR="red"][[/COLOR]Date[COLOR="Red"]][/COLOR] = @Date WHERE AccountID = @id[/iCODE] | |
Re: Welcome to DaniWeb, Please explain better what you are trying to achieve. Also, post code of where you are having trouble so we know you have made some effort. | |
Re: The following is from the help for Dispatcher. [QUOTE]In WPF, a DispatcherObject can only be accessed by the Dispatcher it is associated with. For example, a background thread cannot update the contents of a Button that is associated with the Dispatcher on the UI thread. In order for the background … | |
Re: The code on line 13 and 14 can never be executed because of the [B]return [/B]in line 11. These lines should perhaps be in a [I]void Main()[/I] method. | |
Re: Classes in C# are passed by reference by default; adding ref means you are passing a reference to the variable. So [I]myfunc(ref me, 0) [/I] is passing a reference (or pointer) to [I]me[/I]. This allows [I]myfunc[/I] to change the value held in [I]me[/I] (which is what you do in your … | |
Re: try [CODE]if (sætning5 == "stop" [COLOR="Red"]&& !p.HasExited[/COLOR]) { p.Kill(); }[/CODE] | |
Re: Most 'Events' don't return a value. If they do, then it is via the [I]EventArgs[/I] object. E.g. [I]Cancel[/I] property of a [I]CancelEventArgs[/I] object. Exception handling should be done in the called routine. (i.e. in [I]vExitApplication[/I]) If this does not answer your question then please explain better what you mean by: … | |
Re: You have placed your code in the form constructor. It should go in a [I]Checked[/I] event handler for the check boxes. | |
Re: This series of videos on YouTube covers the basics fairly well. [URL="http://www.wonderhowto.com/how-to-add-save-retrieve-data-sql-server-using-c-programming-visual-studio-389946/"]How to add, save & retrieve data in SQL Server using C# Programming & Visual Studio[/URL] | |
Re: You need to [B]append[/B] to the log file. Also I recommend that you put the writer outside the foreach loop to save opening and closing it each iteration (the same goes for the Connection). Something like this. [CODE]private void button4_Click(object sender, EventArgs e) { // get log file writer System.IO.StreamWriter … | |
Re: If you use code like this to hide the displayed date [CODE] dateTimePicker1.Format = DateTimePickerFormat.Custom; dateTimePicker1.CustomFormat = " "; [/CODE][Edit] (BTW thanks for the tip on how to do this)[/Edit] then you can use the [I]ValueChanged[/I] event to reset the display format. [CODE]private void dateTimePicker1_ValueChanged(object sender, System.EventArgs e) { dateTimePicker1.Format … | |
Re: [URL="http://lmgtfy.com/?q=convert+VB+to+c%23&l=1"]Try this[/URL] Here is the last one done for you [CODE]if (My.Computer.FileSystem.FileExists("Patcher.exe")) { frmMain.show(); } else { // [download the file from webpage, which the code above, the first set of codes, so you don't need to convert again.] } [/CODE] | |
Re: So each post has its own vote count and each user has rep points. If I up(down) vote a post I can choose to modify the posters rep by whatever is my current +/- rep effect and with that the comment I give is visible. However, sometimes I wish to … | |
Re: You get that error because your [I]image[/I] variable is not a standard .Net [I]Image[/I] class. Does the Emgu.CV namespace have any conversion tools to convert from System.Drawing.Image or System.Drawing.Bitmap to Emgu.CV.Image? [Edit] Try this: [iCODE]image = new Image<Bgr, byte>(BitmapFromWeb(sourceURL));[/iCODE] | |
Re: Why not just use the MouseHover event? [CODE] Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Do click code here End Sub Private Sub Button1_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.MouseHover Button1_Click(Nothing, Nothing) End Sub [/CODE] [URL="http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k(SYSTEM.WINDOWS.FORMS.CONTROL.MOUSEHOVER);k(SYSTEM.WINDOWS.FORMS.BUTTON);k(VS.PROPERTIES);k(SYSTEM.WINDOWS.FORMS.BUTTON);k(DESIGNER_SYSTEM.WINDOWS.FORMS.DESIGN.FORMDOCUMENTDESIGNER);k(VISUALSELECTION);k(TargetFrameworkMoniker-%22.NETFRAMEWORK%2cVERSION%3dV4.0%22);k(DevLang-CSHARP)&rd=true"]MSDN - Control.MouseHover Event[/URL] ![]() | |
Re: If you convert your XmlNodeList to a generic list you could use Linq to sort it. Something like this. [CODE]var xmlDoc = new XmlDocument(); // load doc here var tags = xmlDoc.GetElementsByTagName("TagName"); var tagList = new List<XmlNode>(tags.Cast<XmlNode>()); tagList.Sort((a, b) => System.Convert.ToInt64(a["id"]).CompareTo(System.Convert.ToInt64(b["id"]))); [/CODE] | |
Re: To reference static fields you need to use the class name not the name of an instance. e.g. [iCODE] int i = Pay.Click;[/iCODE]. The error you are getting is because [iCODE]ppay.Click[/iCODE] refers to the Click event that can only be set. [Edit] I would also advise against writing you own … | |
Re: If you execute the [I]Setup.exe[/I] program, and not just the [I]MyApplicationName.msi[/I] file, it does a check for prerequisties and installs them if necessary then runs the MSI file to install your application. [Edit] If prerequisties are set to [I]download from website[/I] then internet access is required on the target machine. … | |
Re: [QUOTE=AleMonteiro;1645327]There's no risk in this case. When you publish your project it'll be compiled and the source code won't be visible to the end user.[/QUOTE] C# and VB .Net compile to IL which is very easily decompiled back to code using tools such as Reflector. To help in securing IL … | |
Re: Another way to enable closing the initial form is to use some VB [I]behind the scenes magic[/I] (i.e. use WindowsFormsApplicationBase). [URL="http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/d3ed18d1-a2b0-4d9f-959d-72ec80b26228"]This MSDN thread shows you how.[/URL] If you change [I]ShutdownStyle[/I] to [I]AfterAllFormsClose[/I] it works a treat.:) Note: The code is [I]instead of[/I] that in Program.cs file and you will need … | |
Re: Most likely this is due to file/folder security of the destination folder after installation. To check this you need to answer the following Qs. Do you get any errors when you try to change an XML file? If so, what are they and where in your code do they occur? … | |
Re: Instead of using a [I]Thread [/I]use a [I]BackgroundWorker[/I]. This triggers events for: [INDENT][I]DoWork [/I]- the main execution thread [I]ProgressChanged [/I]- triggered in the work method to update progress bars etc. [I]RunWorkerComplete [/I]- triggers at the end of the job.[/INDENT] [URL="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx"]MSDN- BackgroundWorker Class[/URL] This should suit your task nicely.:) | |
Re: Momerath's solution is probably the cleanest but just for completeness this is an alternative. It works when word wrap is on or off. [CODE]private void textBox3_TextChanged(object sender, System.EventArgs e) { // get graphics for textbox var g = textBox3.CreateGraphics(); SizeF textSize; if (textBox3.WordWrap) // get size of text when word … | |
Re: Be careful when hiding controls behind others. The TAB button will still move the focus to any "visible" controls! This can be confusing for users. I recommend either setting [iCODE]panel1.Visible = !panel2.Visible;[/iCODE] or [iCODE]panel1.Enable = !panel2.Visible;[/iCODE] when panel2 is made visible or hidden. Either of these will prevent TAB from … | |
Re: Just could not resist trying this. The code below moves the image inside the [I]PictureBox[/I]; the [I]PictureBox[/I] does not move. The code paints the image in the [I]PictureBox[/I] explicitly in the Paint event handler. In fact this will paint the image on to any control; it could be a [I]Panel[/I] … | |
Re: When you work on a DataSet or DataTable you are using native .Net types and the strings are unicode which is why your searches work. When you construct your commands in SQL do your build the command string manually in code or do you use SqlParameters to load the values? … | |
Re: Struct are value types and passed by value by default. Classes are reference types and passed by reference. This is the only fundamental difference between the two formats. As far as I am aware there is no difference in the memory consumed by a class or struct with the same … | |
Re: Use [I]Select()[/I] instead of [I]Focus()[/I]. [I]Focus()[/I] sets the visible cues of focus, it does not change the active control. In [I]BTn_Play_Click() [/I] at line 30 you only get input from TBx_P1.Text. You need to choose which input box to use. Testing the [I]TBx_P1.Enabled[/I] property should work here. If you are … ![]() | |
Re: Is it possible that [I]stream.DataAvailable[/I] is going false due to network delays? If this is the case then change the transmission protocol to send the data size first; then the client side knows how much data to expect. Now terminate the read when [I]receivedData [/I]is the correct size (i.e. all … | |
Re: How does this look. [CODE]var buttons = new[] { button1, button2, button3, button4, button5 }; Array.ForEach(buttons, b => b.PerformClick()); [/CODE] | |
Re: By "application folder" do you mean the project folder or the build folder? If you just add a single [I]app.config[/I] file to your project then it is automatically copied to the build folder with the same name as the app but with an added [I].config [/I]extension (e.g. MyApp.exe.config). It is … | |
Re: Your connection string uses "User Instance=True". Is this enabled in your SQL Express installation? [URL="http://social.msdn.microsoft.com/Forums/en-US/sqlgetstarted/thread/45700f5c-59ba-41cd-ac59-46873f26845a/"]MSDN - User Instance=True causes invalid connection string[/URL] See the link below for a whole load of connection string examples. [URL="http://www.connectionstrings.com/sql-server-2008"]Connection strings for SQL Server 2008[/URL] | |
![]() | Re: Should [I]line == ""[/I] then the first if (line 8) will pass to the else clause (line 111) which is testing for [I]line[0] == "!"[/I]. This will generate an error because line is empty! [Edit] Try adding this at the beginning of the foreach loop. [CODE]if (string.IsNullOrWhiteSpace(line)) continue; [/CODE] [Edit2] … |
Re: CRC-16 is a type of checksum. So what are you doing that needs to be checksumed twice? [Edit] More correctly, both are methods of detecting errors in data. Either you do a sum check or you do a CRC. You should not need both. | |
Re: [I]"axWindowsMediaPlayer1.ContainingControl.BackgroundImage"[/I] is the background of the container of the MediaPlayer object! I am not sure that you can do what you want with the MediaPlayer SDK. [URL="http://lmgtfy.com/?q=changing+media+player+background"]This link[/URL] shows why I think this. All the background changers are modifying the registry! | |
Re: What are you using to create your Tower Defence Game? As Mitja said [B]Post more code[/B] showing [B]where the problem is[/B]? | |
Re: You can draw directly to the form using a Graphic object from the [I]CreateGraphics[/I] method. e.g. [CODE]var g = this.CreateGraphics(); g.DrawRectangle(t,l,x,y); [/CODE]Note that anything draw in this way is temporary as it will be erased on the next refresh. @Momerath: I think the OP wants to show the rectangle while … | |
Re: It is also possible that the USB device is added as a virtual serial port. (It should show up under Ports in the Device Manager). If this is the case then you could(should) use RS232 to communicate with the card reader. | |
Re: [QUOTE=biran;1637484]Autonumber field must have value. look at your table[/QUOTE] Thank you for your input. However, this thread is more than two years old. I am sure that by now the original problem has been solved. Please pay attention to the big message above the post window that states [B]This thread … | |
Re: I think you are referring to display of changes made to a database. It is possible to identify a changed row using the DataRow.HasVersion() method. However, this information is only relevant to the current changes. :( To identify changes between program executions you must make a record of the changes … | |
Re: I have not tried it my self but this look like what you want. [URL="http://www.codeproject.com/KB/grid/hierarchgrid.aspx"]CodeProject - DataGridView with hierarchical data binding[/URL] which is based on this [URL="http://blogs.msdn.com/b/markrideout/archive/2006/01/08/customizing-the-datagridview-to-support-expanding-collapsing-ala-treegridview.aspx"]Customizing the DataGridView to support expanding/collapsing (ala TreeGridView)[/URL] All other Googled links I found point to the DataGrid used in ASP.Net or are purchasable … | |
Re: At line 52 you are breaking out of the switch case clause. This does not break your while loop. Try restructuring your code as follows: First get rid of all those [I]goto command[/I] statements and let the while loop to do its job. Use a [I]break[/I] at the end of … |
The End.