w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Equivalent of canvas in Windows forms
You can create your own custom control and override OnPaint method. There you will be able to draw whatever you like in Canvas like mode. Create element specify its coordinates, draw it with Graphics object. And for overlaying use linear drawing order, items drawn later will be top most.

Categories : C#

What is WPF equivalent of Windows Forms Region.Xor in Paint event?
WPF doesn't work like WinForms in terms of graphics. You can't actually draw shapes, you have to place them into your content. Geometry should serve as a good replacement for Region. You can use Geometry.Combine and specify GeometryCombineMode.Xor to replicate your drawing code. RectangleGeometry is how you make rectangles. There are similar classes for other shapes. To actually display the Geometry, put it in a Path, which can be used as a control's content.

Categories : C#

Which event runs line by line in the DataGridView Windows Forms C #?
You got the DataBindingComplete or CellFormatting witch could do what you want edit : You could also use the Load event of the form to apply your formatting only once

Categories : C#

call a Windows Forms method from outside Windows Forms (from int WINAPI WinMain)
it looks like 'Application::Run(myInterface);' does not return until it is done doing what it has to do, which is nothing It's not nothing. Application::Run most importantly starts the Windows event message pump. This event loop is what keeps your application alive and running. Application::Run will return only when this loop exits. The event loop generally exits when you close your main form or try to close the process from task manager etc. Which means by the time Application::Run returns, your myInterface form is already closed - which makes rest of the code below it useless. You can move that code to something like Form's Load event.

Categories : C++

parsing data between forms to datagridview
In the frmMain declare the fConn form at the class level so that it won't get disposed when the form closes. Now the frmMain can access any public objects in fConn. Don't re-declare frmMain in fConn. Use _textBox = op._textBox1 right after op.ShowDialog();

Categories : C#

Can I display datagridview on view like we do in forms? if yes then how?
You might like to take a look at this question: grid controls for ASP.NET MVC? It was closed as not constructive for being a request for recommendations, but there are certainly a lot of data grid options recommended there that you might like to check out. But in short, ASP.NET MVC does not really share WebForms' design philosophy of dragging and dropping complex components - its philosophy is more aimed at "I know exactly what I want on my page, now I need to implement it". If that's not what you're after, you might be better sticking with WebForms.

Categories : C#

How to rotate windows forms in every 20 secs using timer in windows application?
On a 20 second timer you can call 'BringToFront' on each form. http://msdn.microsoft.com/en-us/library/system.windows.forms.control.bringtofront.aspx

Categories : Vb.Net

csv to datagridview in c# windows application
You can do it in linq like this var lines = File.ReadAllLines("yourcsvfile.csv").Select(a => a.Split(',')).ToList(); foreach (string[] s in lines) { dataGridView1.Rows.Add(s[5], s[6], s[7]); } by the way i tried your input and it seems there are 7 columns not 3. Do you want to exclude any?

Categories : C#

DataGridView in Windows form using C#
Create class Email: public class Email { public Email(string email) { Address = email; int index = email.IndexOf('@'); UserName = email.Substring(0, index); Domain = email.Substring(index + 1); } public string Address { get; private set; } public string UserName { get; private set; } public string Domain { get; private set; } } And data-bind your grid to instances of this class: var emails = from line in File.ReadLines(fileName) select new Email(line); grid.DataSource = emails.ToList(); If you need first column to be named Email, then add columns manually and provide names of email class properties as DataPropertyName for each column. UPDATE: There is already existing class MailAddress in System.Net.Mail

Categories : C#

keydown event Does not work on forms but does work on Datagridview in Vb.net
Change the .KeyPreview property of the form to True. When this property is set to true, the form will receive all KeyPress, KeyDown, and KeyUp events. More information in MSDN Documentation.

Categories : Vb.Net

how can i show datagridview alone in each and every 20secs in windows application?
Here is a very clear walk-through on how to rotate(Change rows and column of a Grid view). http://aspsnippets.com/Articles/Rotate-ASPNet-GridView---Convert-GridView-Columns-to-Rows-and-Rows-to-Columns.aspx

Categories : C#

Datagridview Windows application API call on Scroll
What you want is VirtualMode for the DataGridView. Check out this MSDN Article which explains why it is good for your bulk data. Virtual mode is designed for use with very large stores of data. When the VirtualMode property is true, you create a DataGridView with a set number of rows and columns and then handle the CellValueNeeded event to populate the cells. Virtual mode requires implementation of an underlying data cache to handle the population, editing, and deletion of DataGridView cells based on actions of the user. For more information about implementing virtual mode, see How to: Implement Virtual Mode in the Windows Forms DataGridView Control. There is also a tutorial on setting this up here.

Categories : C#

Filter rows in datagridview in C#.net windows application
This did work for me: BindingSource bs = new BindingSource(); bs.DataSource = dataGridView1.DataSource; bs.Filter = sColumnaDoPrzeszukania + " like '%" + textBox1.Text + "%'"; dataGridView1.DataSource = bs; The whole question is here: How to filter a datagridview by a textbox after loading an excel file into it

Categories : Database

displaying string of array in datagridview c# windows application
You can use this overload of Split which allows you to choose the number of elements to return (7 in this case). var lines = File.ReadAllLines("E:\messages.csv") .Select(a => a.Split(new[] {','}, 7)).ToList(); foreach (string[] s in lines) { dataGridView1.Rows.Add(s[2], s[5], s[6]); }

Categories : C#

Windows equivalent of $export
To translate your *nix style command script to windows/command batch style it would go like this: SET PROJ_HOME=%USERPROFILE%/proj/111 SET PROJECT_BASEDIR=%PROJ_HOME%/exercises/ex1 mkdir "%PROJ_HOME%" mkdir on windows doens't have a -p parameter : from the MKDIR /? help: MKDIR creates any intermediate directories in the path, if needed. which basically is what mkdir -p (or --parents for purists) on *nix does, as taken from the man guide

Categories : Windows

what is the equivalent UpdateSystemActivity on windows
Use SetThreadExecutionState() to indicate it Windows that the system is NOT idle. You may also want to disable the screensaver as described here. It is NOT a good practice to do so without the consent of the user. A checkbox in your settings Dialog allowing the user to enable such behaviour would be most appropriate.

Categories : C#

How to Insert Data in Database through DataGridView in Windows Form Application
You have multiple questions. I will answer the "how to add empty row" one. For that After you populate your dataset and before you bind it to the Grid you should add an empty row to the top of this dataset. ' insert a blank row at the top Dim dr As DataRow = MyGrid.Tables(0).NewRow() dr("MyFiled") = "0" MyGrid.Tables(0).Rows.InsertAt(dr, 0) There are many articles on internet showing how to save data. If you have problem with those please write your specific code here.

Categories : C#

WPF in Windows Forms
If you find yourself in need to open a WPF Window from a WinForms program: Create/Add a new project of type "WPF Custom Control Library" Add a new Item of type "Window (WPF)" Do your thing with the WPF Window From your WinForms app, create and open the WPF Window. code snippet: WPFWindow.Window1 wpfwindow = new WPFWindow.Window1(); ElementHost.EnableModelessKeyboardInterop(wpfwindow); wpfwindow.Show(); However ensure you have the following using statements: using System; //Given using System.Windows.Forms; //Given using System.Windows.Forms.Integration; //Not so Given. Refer: How to programmatically create a WPF window in a WinForm application Open a WPF Window from WinForms & link form app with WPF app How to add a WPF window to a WinForms App

Categories : C#

boost equivalent to windows mutex
What you need is a boost::recursive_mutex: The recursive_mutex class uses a Recursive locking strategy, so attempts to recursively lock a recursive_mutex object succeed and an internal "lock count" is maintained. Attempts to unlock a recursive_mutex object by threads that don't own a lock on it result in undefined behavior. Note that the boost::mutex: The mutex class uses an Unspecified locking strategy, so attempts to recursively lock a mutex object or attempts to unlock one by threads that don't own a lock on it result in undefined behavior. This strategy allows implementations to be as efficient as possible on any given platform. In Computer Science the recursive mutex is called Reentrant Mutex: In computer science, a reentrant mutex is a mutual exclusion, recursive

Categories : C++

qt linux "QMAKE_CXXFLAGS += -std=c++11" equivalent for windows?
For my qt project on Windows I have used "QMAKE_CXXFLAGS += -std=c++0x" for new-standard features. MinGW 4.8 (supports many c++11 features) you may download here.

Categories : C++

Async in Windows Forms
Yes. Async is a C# 5.0 language feature and will work anywhere, as long as you have the supporting BCL types (.Net 4.5, or Microsoft.Bcl.Async from NuGet). However, you should never write async voids anywhere, except for event handlers.

Categories : C#

File I/O with Windows Forms
Normally, you can convert a std::string into a System::String^ quite easily (it's even possible that simply using gcnew String(myPrimoAnnoObj.cognome) will give you a string with the right contents, easily written into the managed stream. However you appear to have failed to grasp how new works for unmanaged objects: Your code allocates a primo_anno structure dynamically for no reason, before copying its value into the list and leaking the pointer. You also leak the pointers to the unmanaged strings you obtained from the Marshal class. Are you sure you should be using unmanaged objects? It would be much easier to have everything in a managed System::Collections::Generic::List<> of managed objects... Added: For writing everything in a file, you can try something like this: ref c

Categories : List

Windows Forms Logins
There seem to be a few issues with your code: You should validate your inputs before running the query You should parameterize your queries (there are lots of samples on SO) instead of using string concatenation You seem to be assuming you will get a result from your SQL query. You should maybe check dr.HasRows to see if the details are correct, or check if dr.Read() returns true to determine whether to display the message box or not You should dispose of your DB objects using using blocks. E.g. (not sure why formatting isn't working): using (SqlConnection con = Helper.getconnection()) { ... } instead of calling Dispose and Close explicitly. Even if you do want to call Dispose and Close explicitly you should do so in a finally block.

Categories : C#

Multithreading with windows forms C#
I have the application working as a console application but when I try to build it as a windows form application it screws up. Provided that you didn't change your logic during the port to Windows Forms, this is likely due to updating the Windows Forms controls from the background thread within your Task. You can only use Windows Forms controls from the main (UI) thread, and not from a background thread. If you want to perform an update to the UI, you need to use Control.Invoke or Control.BeginInvoke to marshal the call back onto the UI thread.

Categories : C#

Trying to get the ID of id in c# (Windows Forms)
As @MarcB pointed out, .Document.GetElementById("idHere") will get the <td> element, not the <a> element. If you want the <a> you will need something like: var a = webBrowser.Document.GetElementById("idHere").FirstChild; You haven't shown us the content of your href attribute, but assuming it is safe to click it, you can call: a.InvokeMember("Click");

Categories : C#

Forms is not a member of Windows
You're using VSE2k12 "for Web". I'm not convinced that's going to include stuff explicitly marked as being for "Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system" :-) You may need to consider getting a more expansive edition of the development environment.

Categories : Dotnet

MVC - Forms and Windows authentication
Since MVC doesn't use the physical folder structure (except for Content, like scripts, images, css, etc.. and even then in MVC4 much of that is now virtualized in bundles), all authentication is done at the root of the site, more or less. You would be better off creating a sub-site with it's own web.config and authentication settings rather than trying to do two forms of authentication in the same site.

Categories : Asp Net Mvc

How to use Objects in Windows Forms C++
To be able to acces any variable from multiple handlers you have to make those variables global. Also the objects are deleted using a destructor and not delete operators. Also it is a bad habit explicitly calling the destructor. In your case if you will call it the program, it will crash as at the end of the execution the compiler will call on it's own the destructors for all the objects again and try to free the freed allready by you memory.

Categories : C++

Eventhandler "bug" using VB.NET with windows forms
Doing anything with Application.Idle is a lost cause. Not only does your app go idle immediately after the screen saver activates, you also never stop being idle while it is running. The screen saver switches the active desktop to a dedicated secure desktop, none of the running programs will ever get any input, not until it de-activates. You can observe the desktop switch, the SystemEvents.SessionSwitch event fires. Do note the considerable lack of practical usefulness of code like this. Curiosity is okay but there are always a lot of things to learn. The screen saver should be at the bottom of your list.

Categories : Vb.Net

Is there equivalent to O_NONBLOCK when opening a file on Windows?
Do you have any control over the application generating the logfile? Because depending on the way the file is open by that application, you really can't modify it. This link may seem off-topic here, but deep in Windows, what determines the file access to other application is the dwShareMode parameter of the CreateFile function: http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%28v=vs.85%29.aspx The application should enable FILE_SHARE_WRITE and possibly FILE_SHARE_DELETE, plus it should flush and update the file position everytime it writes a file. Looking at the Python documentation for open(), there is no such detailed parameter.

Categories : Python

What is the equivalent of Application.ExecutablePath in Windows Service
Have a look at AppDomain.BaseDirectory Property Gets the base directory that the assembly resolver uses to probe for assemblies. The most common usage would be similar to var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;

Categories : C#

How to get the equivalent of IS_MEMBER for a certain User using "Windows Login"
For server roles (which your original question seemed you were after): SELECT r.name FROM sys.server_role_members AS m INNER JOIN sys.server_principals AS l ON m.member_principal_id = l.principal_id INNER JOIN sys.server_principals AS r ON m.role_principal_id = r.principal_id WHERE l.name = N'DOMAINUsername'; -----------------^^^^^^^^^^^^^^^ replace this part with your domainuser For database roles: SELECT r.name FROM sys.database_role_members AS m INNER JOIN sys.database_principals AS dp ON m.member_principal_id = dp.principal_id INNER JOIN sys.server_principals AS l ON dp.[sid] = l.[sid] INNER JOIN sys.database_principals AS r ON m.role_principal_id = r.principal_id WHERE l.name = N'DOMAINUsername'; -----------------^^^^^^^^^^^^^^^ replace

Categories : SQL

Passing Values Between Windows Forms c#
You need to put loginData into a local variable inside the frmVoiceOver class to be able to access it from other methods. Currently it is scoped to the constructor: class frmVoiceOver : Form { private NewDataSet _loginData; public frmVoiceOver(NewDataSet loginData) { _loginData = loginData; InitializeComponent(); } private void btnVoiceOverNo_Click(object sender, EventArgs e) { // Use _loginData here. this.Close(); Form myFrm = new frmClipInformation(); myFrm.Show(); } } Also, if the two forms are in the same process you likely don't need to serialize the data and can simply pass it as a standard reference to the form's constructor. Google something like "C# variable scope" to understand more in this area as

Categories : C#

C# Mixing WinRT and Windows Forms
WinRT UI components can only be used in windows store apps and Windows Forms only in desktop apps so you will not be able to mixed both. If you are looking into making a desktop app for windows 8, maybe you should look into using WPF. If you are looking into making a windows store app, there is plenty of third party control libraries which have a TreeView including the WinRT xaml toolkit .

Categories : C#

IsNumeric on VS2012 (windows forms)
As I understand, you only want to keep numbers chars (no ".", ",", ...) Using Where() and VB's lamba expression. This selects then count any caracter not in the digits string, then checks if the count is equal to zero. If IsNumeric(myString.Where(Function(c) Not "0123456789".Contains(c)).Count() = 0) Then not important code Else MsgBox("O campo minutos só pode conter números!") End If Better, using Any() instead of Where().Count() If IsNumeric(Not myString.Any(Function(c) Not "0123456789".Contains(c))) Then not important code Else MsgBox("O campo minutos só pode conter números!") End If This could probably be done with a regular expression too.

Categories : Vb.Net

Closing Forms in Windows Form App?
My problem is when I click the button on FormB to reopen FormA, and when I click the exit button on FormA, it doesn't stop debugging. This is because you opened another instance of FormA form your FromB What should I do? You need to get a reference of FormA in FormB and Show that instead. How do i do it? public class FormA { private void btnOpenformB_Click(System.Object sender, System.EventArgs e) { FormB B = new FormB(); B.Closed+=OnFromBClosed; //Add this to handle FromB Closed event this.Hide(); B.Show(); } private void btnExit_Click(System.Object sender, System.EventArgs e) { this.Close(); } //Show FormA again when FromB is closed protec

Categories : C#

.NET C# main method and windows forms
Method 1 In the main function use the following: Application.Run(new Form1()); You will also need to add the following line at the top of your file: using System.Windows.Forms; Method 2 In the main function, you could add this: Form1 c = new Form1(); c.ShowDialog(); Both methods will show your form as a dialog. The console will still be visible in the background however. If you want to then hide the console window the following link gives instructions to do so (but it's a little convoluted): http://social.msdn.microsoft.com/Forums/vstudio/en-US/ea8b0fd5-a660-46f9-9dcb-d525cc22dcbd/hide-console-window-in-c-console-application

Categories : C#

Maximised child forms in Windows MDI
Why do you try to look on this link below i think it might help. http://social.msdn.microsoft.com/Forums/windows/en-US/9fa480ba-d0ce-4c70-8a22-dc740d710622/mdi-application-child-forms-maximizenormalminimize-independent

Categories : Windows

Interaction between JavaScript and Windows Forms
Yes it's possible using InvokeScript on the browser control; see this article for more information: http://www.codeproject.com/Tips/127356/Calling-JavaScript-function-from-WinForms-and-vice

Categories : C#

Convert a Windows Forms app to Metro UI app
I think it's quite difficult. Maybe we can seperate the logical code and UI code , reserve the logical code and recreate a UI for Metro Style. It's hard to convert the WinForm UI code to Metro's. Metro apps based on WinRT have many differents from WinForm, not only the namespace or method name but some implementing code are different. There are lots of method we can use or information we can get in WinForm are not supported in Metro. Converting WinForm to Metro will be a large project I think.

Categories : Windows



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.