Search Results

Search found 923 results on 37 pages for 'messagebox'.

Page 22/37 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Why the property is not called on Binding in WPF?

    - by azamsharp
    I am not sure why the property is not being called on Binding. Here is the code: <myusercontrol Text ="{Binding Description, UpdateSourceTrigger=LostFocus,Mode=TwoWay, ValidatesOnDataErrors=True}" IsReadOnly ="{Binding AllowEditing}" /> And here is the myusercontrol IsReadOnly property: public static DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof (bool), typeof ( myusercontrol)); public bool IsReadOnly { get { return ((bool) GetValue(IsReadOnlyProperty)); } set { MessageBox.Show(value.ToString()); SetValue(IsReadOnlyProperty, !value); OnPropertyChanged("IsReadOnly"); } } The message box is never displayed! Any ideas!

    Read the article

  • C#: how to check and display the content of a folder?

    - by user147685
    I'm not sure whether this topics has been disscussed before or not, but I'm not sure the exact word to search for it. What method/class should I use? The program has 3 buttons: 1) for folder browsing, 2) scan for the selected folder content, and 3) open the file. When user browse the selected folder*(1), user click scan button to scan from the first file until the last available files and listed it text box(2)* and from that user can decide whether to open the files or not*(3)*. Here are what have I done so far (no 1 and 3): //For browse. private void browse2() { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { this.txtDest.Text = folderBrowserDialog1.SelectedPath; } } //For opening folder. private void btnOpen_Click(object sender, EventArgs e) { try { Process.Start(txtDest.Text); } catch { MessageBox.Show("Please select one file/folder"); } }

    Read the article

  • XmlTextReader issue

    - by Stanislav Palatnik
    I'm try to parse this xml, but c# keeps throwing an exception saying it has invalid characters. I can't copy the text from the messagebox directly, so I've screened it. http://img29.imageshack.us/img29/694/xmler.jpg Here's the code to get the string string strRetPage = System.Text.Encoding.GetEncoding(1251).GetString(RecvBytes, 0, bytes); while (bytes > 0) { bytes = socket.Receive(RecvBytes, RecvBytes.Length, 0); strRetPage = strRetPage + System.Text.Encoding.GetEncoding(1251).GetString(RecvBytes, 0, bytes); } int start = strRetPage.IndexOf("<?xml"); string servReply = strRetPage.Substring(start); servReply = servReply.Trim(); servReply = servReply.Replace("\r", ""); servReply = servReply.Replace("\n", ""); servReply = servReply.Replace("\t", ""); XmlTextReader txtRdr = new XmlTextReader(servReply);

    Read the article

  • Class inheriting from several Interfaces having same method signature

    - by Manish
    Say, I have three interfaces: public interface I1 { void XYZ(); } public interface I2 { void XYZ(); } public interface I3 { void XYZ(); } A class inheriting from these three interfaces: class ABC: I1,I2, I3 { // method definitions } Questions: If I implement like this: class ABC: I1,I2, I3 { public void XYZ() { MessageBox.Show("WOW"); } } It compiles well and runs well too! Does it mean this single method implementation is sufficient for inheriting all the three Interfaces? How can I implement the method of all the three interfaces and CALL THEM? I know it can done using explicit implementation but I'm not able to call them. :(

    Read the article

  • how i insert values from list of Data Grid View?

    - by Six fourty
    it show me this error Incorrect syntax near the keyword 'Select' to make to clear Employee ID in this case is FK in the table (Attendance detail) and the other thing is i am using Data Grid View from another table(Employee information) to Show the list of the staff in my form. then i want to transfer each selected cell value from Data Grid View to attendance detail table. 10q private void time_in_Click(object sender, EventArgs e) { employee_InformationDataGridView.SelectedCells[0].Style.ForeColor = Color.Green; time_in.Enabled = false; time_out.Enabled = true; con = new SqlConnection(GlobalClass.conn); con.Open(); SqlCommand cmd = new SqlCommand("Insert into Attendancedetail Values(" + "Select from EmployeeInformation(EmployeeID)" + ",'" + employee_InformationDataGridView.SelectedCells[0] + "','" + DateTime.Now.ToLongDateString() + "','" + null + "','" + null + "','" + DateTime.Now.ToLongTimeString() + "'," + null + ")", con); int i = cmd.ExecuteNonQuery(); MessageBox.Show(i.ToString() + " record inserted"); }

    Read the article

  • how to run progress-bar through insert query ?

    - by Gold
    hi i have this insert query: try { Cmd.CommandText = @"INSERT INTO BarcodTbl SELECT * FROM [Text;DATABASE=" + PathI + @"\].[Tmp.txt];"; Cmd.ExecuteNonQuery(); Cmd.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message); } and i have two question: how to run progress-bar from the begging to the end of the insert ? if there any error i got the error exception and the action is stop - the query stop and the BarcodTbl is empty. how i can see the error and that the query will continue to fill the table ? thank's in advance

    Read the article

  • Copy and Store LPTSTR in class causes crash

    - by Jake M
    I am attempting to copy a LPTSTR and store that string as a member variable in an object. But my attempts to copy the LPTSTR seem to fail and when I go to access/print the value of the copied LPTSTR I get a program crash. Is it possible to copy a LPTSTR and store it in my class below or is it better to just use a TCHAR*? class Checkbox { private: LPTSTR text; HWND hwnd; public: Checkbox(HWND nHwnd, LPTSTR nText) { lstrcpy(checkText, text); } void print() { // Causes a crash MessageBox(hwnd, text, text, MB_OK); } };

    Read the article

  • Does a modeless dialog processes WM_DESTROY Message?

    - by Dave17
    I'm trying to create a modeless dialog as the main window of a program but it doesn't seem to respond WM_DESTROY or WM_NCDESTROY Message. HWND hwnd=CreateDialogParamA(hInst,MAKEINTRESOURCE(IDD_DIALOG1),0,DialogProc,LPARAM(this)); if (!hwnd) { MessageBox(0, "Failed to create wnd", 0, 0); return NULL; } ShowWindow(hwnd,nCmd); UpdateWindow(hwnd); while (GetMessage (&msg, NULL, 0, 0) > 0) { if (!IsWindow(hwnd) || !IsDialogMessage(hwnd,&msg)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } } Modeless Style format from Resource file STYLE DS_SETFONT | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU

    Read the article

  • Using Timer only once

    - by zaidwaqi
    Hi, I want to use a timer only once, at 1 second after the initialization of my main form. I thought the following would have a message box saying "Hello World" just once, but actually a new message box says "Hello World" every one second. Why so? I had put t.Stop() in the tick event. Also, do I need to dispose the timer somehow to avoid memory leakage? Timer t = new Timer(); t.Interval = 1000; t.Tick += delegate(System.Object o, System.EventArgs e) { MessageBox.Show("Hello World"); t.Stop(); }; t.Start(); Please help and show if there is a better way of doing this? Thanks.

    Read the article

  • load report fail in crystal reports doesn't have solution.

    - by mr-developer
    hi all, i'm using c sharp and crystal reports in visual studio 2008 in my application. the problem is that there is a form that i have crystalreporviewer on, when i call the form from form1 by button click event, the form and the report loads perfect, but when i call the from from another from that i've called from form1, this exception appears "load report fail". how can i solve this problem. i've googled and i didn't find any solution. I think there is a difference between form1 and the other form which i call the form of the report from. this is the code of the report form load try { cryRpt.Load("..\\..\\CrystalReport1.rpt"); crystalReportViewer1.ReportSource = cryRpt; crystalReportViewer1.Refresh(); } catch(Exception ex) { MessageBox.Show(ex.Message); } thanks in advance for any replies

    Read the article

  • c# Reflection - Find the Generic Type of a Collection

    - by Andy Clarke
    Hi, I'm reflecting a property 'Blah' its Type is ICollection public ICollection<string> Blah { get; set; } private void button1_Click(object sender, RoutedEventArgs e) { var pi = GetType().GetProperty("Blah"); MessageBox.Show(pi.PropertyType.ToString()); } This gives me (as you'd expect!) ICollection<string> ... But really I want to get the collection type i.e. ICollection (rather than ICollection<string>) - does anyone know how i'd do this please?

    Read the article

  • Handling Dialogs in WPF with MVVM

    - by Ray Booysen
    In the MVVM pattern for WPF, handling dialogs is one of the more complex operations. As your view model does not know anything about the view, dialog communication can be interesting. I can expose an ICommand that when the view invokes it, a dialog can appear. Does anyone know of a good way to handle results from dialogs? I am speaking about windows dialogs such as MessageBox. One of the ways we did this was have an event on the viewmodel that the view would subscribe to when a dialog was required. public event EventHandler<MyDeleteArgs> RequiresDeleteDialog; This is OK, but it means that the view requires code which is something I would like to stay away from.

    Read the article

  • Should I call class destructor in this code?

    - by peterg
    I am using this sample to decode/encode some data I am retrieving/sending from/to a web server, and I want to use it like this: BOOL HandleMessage(UINT uMsg,WPARAM wParam,LPARAM lParam,LRESULT* r) { if(uMsg == WM_DESTROY) { PostQuitMessage(0); return TRUE; } else if(uMsg == WM_CREATE) { // Start timer StartTimer(); return TRUE; } else if(uMsg == WM_TIMER) { //get data from server char * test = "test data"; Base64 base64; char *temp = base64.decode(test); MessageBox(TEXT(temp), 0, 0); } } The timer is set every 5 minutes. Should I use delete base64 at the end? Does delete deallocates everything used by base64?

    Read the article

  • How can a client try to reconnect to a server after a first failed try with WCF?

    - by djerry
    Hey guys, I'm using a client - server app. When a client starts, he gets a login-screen. When the server is not up yet, the call to the server will throw an exception which i catch (EndpointNotFoundException). I show a messagebox telling the user the server is offline. When he tries to reconnect again, it will throw another exception (CommunicationObjectFaultedException), even though the server is online. When a new client starts then, he can connect to the server. But the client who attempted before, still gets the error. My question now is how can the first client login after a failed first try without having to start his program again. So i want to clear the communicationchannel of its faulted state or something like that. Thanks in advance.

    Read the article

  • Losing DateTimeOffset precision when using C#

    - by Darvis Lombardo
    I have a SQL Server table with a CreatedDate field of type DateTimeOffset(2). A sample value which is in the table is 2010-03-01 15:18:58.57 -05:00 As an example, from within C# I retrieve this value like so: var cmd = new SqlCommand("SELECT CreatedDate FROM Entities WHERE EntityID = 2", cn); var da = new SqlDataAdapter(cmd); DataTable dt =new DataTable(); da.Fill(dt); And I look at the value: MessageBox.Show(dt.Rows[0][0].ToString()); The result is 2010-03-01 15:18:58 -05:00, which is missing the .57 that is stored in the database. If I look at dt.Rows[0][0] in the Watch window, I also do not see the .57, so it appears it has been truncated. Can someone shed some light on this? I need to use the date to match up with other records in the database and the .57 is needed. Thanks! Darvis

    Read the article

  • How to best fetch a cell value from excel using VSTO?

    - by Behrooz Karjooravary
    I am trying to get cells from excel into csharp but not sure what's the best variable type to read it into. If I make the variable a string and the cell value is a double I get a parse error. If I make the variable double then when the cell is a string it wont work. Here's the code I am running: try { string i = Globals.Sheet1.Cells[7, 7].Value; double num; if (i == null) return; if (double.TryParse(i, out num)) { . . . } } catch (Exception e) { MessageBox.Show(e.ToString()); }

    Read the article

  • Questions about Window Handles

    - by Kovu
    Hi, lang: c#.net 2.0 I have a Application X, that calls SubWindows 1, 2 and 3. I will Pop up a MessageBox, when 1, 2 or 3 is opened. My idea is a timer that ticks every 3 seconds and checks if the windows are opened. But how to find the 3 exact windows? Can I use a Window-Handle-Spy-Application and Hardcode the Window-Handles in my code to find them ever? Or change the window handle when the Application X is opened new?

    Read the article

  • Getting a pid of a process created in C#

    - by Adrian
    Lets say that I'm trying to create a new process with the following code: System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); p.StartInfo.FileName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\AwesomeFile.exe"; p.StartInfo.Arguments = "parameter1 parameter2"; p.StartInfo.CreateNoWindow = true; p.Start(); and right in the next line, I'll try to get a pid of that process with the following line: MessageBox.Show(p.Id); This line is giving me the "No process is associated with this object." error. Any idea as to why this error occurs?

    Read the article

  • Comparing date in access database

    - by Simon
    How can i compare the day in the access database to a given day in c#? The date column in the database is an general date(day/month/year) try { database = new OleDbConnection(connectionString); database.Open(); date = DateTime.Now.ToShortDateString(); string queryString = "SELECT user_name,zivila.naziv " + "FROM (users LEFT JOIN obroki_save ON obroki_save.ID_uporabnika=users.ID)" + " LEFT JOIN zivila ON zivila.ID=obroki_save.ID_zivila " + " WHERE users.ID= " + a.ToString() + " AND obroki_save.datum=# " + date; loadDataGrid(queryString); } catch (Exception ex) { MessageBox.Show(ex.Message); return; }

    Read the article

  • save the input value in a 2dimentsion array

    - by arash
    hi friends,how can i save the number that user enter in textbox in a 2 dimension array? for example: i have this numbers in textbox:45,78 and now i want to save 45,32 like this: array[0,0]=45 and array[0,1]=78 how can i do that?thanks,so much edited: oh,when i entered 1,2,3,4,5,6,7,8,9 in textbox and it takes [2,2]=56 private void button10_Click(object sender, EventArgs e) { int matrixDimention = 2; int[,] intValues = new int[matrixDimention + 1, matrixDimention + 1]; string[] splitValues = textBox9.Text.Split(','); for (int i = 0; i < splitValues.Length; i++) intValues[i % (matrixDimention + 1), i % (matrixDimention + 1)] = Convert.ToInt32(splitValues[i]); string a=intValues[2,2].ToString(); MessageBox.Show(a); } when i take: string a=intValues[2,1].ToString(); it shows 0

    Read the article

  • Using Function return in global variable vb.net

    - by Cold Assassin
    Can't seem to figure out how to use a function return variable in global Dims example code: Public Class Main Dim Path As String = FixPath() Dim fixwrongtxt As String = Path & "tryme.txt" Private Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load FixPath() On_load() End Sub Private Function FixPath() As String Path = "C:\test" MsgBox(Path) //First Message Box' Return Path End Function Sub On_load() MsgBox(fixwrongtxt) //Second Message Box End Sub End Class when I run it all I get the first message box that contains "C:\test" and I click ok and on the second messagebox I get "custom.dll" with out the "C:\test" or "Path Return" What am I doing wrong? I know I can't use // in vb.net. I have also tried adding "FixPath()" under Sub On_load() but got same result. Also the reason I have to have these global is because I have around 30 Subs that refer to "Path" Variable... Thanks

    Read the article

  • How to pass event to method?

    - by tomaszs
    I would like to create a method that takes as a argument an event an adds eventHandler to it to handle it properly. Like this: I have 2 events: public event EventHandler Click; public event EventHandler Click2; Now i would like to pass particular event to my method like this (pseudocode): public AttachToHandleEvent(EventHandler MyEvent) { MyEvent += Item_Click; } private void Item_Click(object sender, EventArgs e) { MessageBox.Show("lalala"); } ToolStripMenuItem tool = new ToolStripMenuItem(); AttachToHandleEvent(tool.Click); Is it possible or do I not understand it good? Edit: I've noticed with help of you that this code worked fine, and returned to my project and noticed that when I pass event declared in my class it works, but when I pass event from other class id still does not work. Updated above example to reflect this issue. What I get is this error: The event 'System.Windows.Forms.ToolStripItem.Click' can only appear on the left hand side of += or -=

    Read the article

  • how do i check if multiple folders exist if so delete them on button click?

    - by NightsEVil
    hi i have a few folders created by my application and id like that when they click a button named "clean up" that it would check to see if any of the predetermined folders exist, if they do then delete them, this is what i have tried so far whats wrong with it? string tempFolder = Environment.GerFolderPath(Environment.SpecialFolder.ApplicationData); if (Directory.Exists(tempFolder + "//" + "temp1")) if (Directory.Exists(tempFolder + "//" + "temp2")) if (Directory.Exists(tempFolder + "//" + "temp3")) if (Directory.Exists(tempFolder + "//" + "temp4")) { System.IO.Directory.Delete(tempFolder + "\\" + "temp1", true); System.IO.Directory.Delete(tempFolder + "\\" + "temp2", true); System.IO.Directory.Delete(tempFolder + "\\" + "temp3", true); System.IO.Directory.Delete(tempFolder + "\\" + "temp4", true); } else { MessageBox.Show("No Cleanup Needed"); } so whats wrong? i tested it and it seemed to with 2 folder but not 4 or more

    Read the article

  • status failed for LdrLoadDll

    - by kiddo
    hello all,I'am trying to work-out the LdrLoadDll function and am having no luck with that..i also googled for some examples there is no much documentation or correct example about this.I know what it exactly does..Please check the code below. //declaration function pointer for LdrLoadDll typedef NTSTATUS (_stdcall*fp_LdrLoadDll)( IN PWCHAR PathToFile OPTIONAL, IN ULONG Flags OPTIONAL, IN PUNICODE_STRING ModuleFileName, OUT PHANDLE ModuleHandle ); //calling LdrLoadDll using getprocaddress HANDLE handle; HMODULE module = LoadLibrary(L"ntdll.dll"); fp_LdrLoadDll loadDll; loadDll = (fp_LdrLoadDll)GetProcAddress(module,"LdrLoadDll"); if(loadDll == NULL) { MessageBox(0,L"Not able to load the function",L"LdrLoadDll",&handle); } UNICODE_STRING input; input.Buffer = L"C:\\Desktop\\myDll.dll"; input.Length = wcslen(input.Buffer)*2; input.MaximumLength = wcslen(input.Buffer) +2; NTSTATUS status = loadDll(NULL,LOAD_WITH_ALTERED_SEARCH_PATH,&input,0); When i execute the above am not getting the handle niether valid status.Please help me with this.

    Read the article

  • How to make the title bold?

    - by Solitaire
    Hi all, In Qmessagebox how can I make the title text bold? Here is the sample code, which I am using to disply a messagebox int ret = QMessageBox::warning(this, tr("My Application"), tr("document has been modified.\n" "Do you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save); I just want “tr("My Application")” to be bold, and rest to be in normal font. How can I do that? By default I am getting the normal font for both title and descriptive text. Thanks.

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >