|
I tried that (I put a MessageBox.Show("") in the if statement and it never popped up. I moved it out of the if and it still didn't show up. I set the KeyPreview to true.
|
|
|
|
|
I would like to get an object from one of the following known values:
1. Window Handle
2. Process Id
3. Associated Threads
Conversely, I could get one of the above values from an object and be able to perform my operation that way. Currently, I can create a new MS Word instance, and I can get all of the open MS Word applications into data objects, but I cannot tell which one is the one that I created. Does anyone know a way to do this? Thanks,
Jeff
|
|
|
|
|
Hi Jeff,
when you start a process with Process.Start() I expect Process.Id to contain the PID.
Does that help?
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
I am essentially attempting to ensure that my Microsoft.Office.Interop.Word.Application object corresponds to the new instance of MS Word that I just created. Yes, process has information such as process Id, process start time, window handle, etc., but the Word.Application object has none of those things in itself or any child elements (as far as I can tell). I was wondering if there is some way that I can test to see if the object that I am obtaining from the call to Marshal.GetActiveObject("Word.Application") is in fact the one that I created. There are certain tests that I am doing to ensure that I did get the proper one, such as ensuring that Word.Application.(Visible, Width, Height, X, Y) match the values that I set them to on the window with WinAPI calls, but there has to be a cleaner way to do this. Any additional info would be appreciated. Thanks,
Jeff
|
|
|
|
|
Sorry Jeff, I have no prior experience with Microsoft.Office.Interop.Word.Application
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
As one of my side projects I've been shuffling through the Adobe PDF 1.8 documentation, thinking about how to whip up a useful (if not entirely complete) library to print to PDF. PostScript takes a little bit to get used to but it's not bad.
My latest milestone was finding a way to retrieve a font from the system and it into the output stream (as PDF features embedded fonts). Now most of the major commercial vendors implement partial font embedding (i.e. only embedding the characters that you've used in your PDF document, rather than the entire font). I think this would be a useful addition to my homebrew library, but MSDN and Google are a bit light on documentation on the Font object.
So I suppose my question to you fine fellow programmers is, is there a way to take a .NET framework (2.0) Font object, remove all but a defined set of characters, and then write the remaining bits to a MemoryStream or FileStream? Would I have to do this unmanaged? Would I have to be so desperate as to break the font apart at the byte level in C++ and manually copy the relevant glyph data to the stream?
Please don't bother me... I'm hacking right now. Don't look at me like that - doesn't anybody remember what "hacking" really means?
|
|
|
|
|
Hello everybody
I have a txtbox where i write the name of my customrs in, the customer might be old and might be new
so the old one have an id and the name is in the database
what i want to do is when i begin write the name of the customer directly the nearst word appear in the txtbox
Ex:
in the database i have the name John
when i write the name to my customer Jony
when i press J whole the word John appear and ohn will be selected
when i press o also the word John still in the textbox but just hn is selected
when i press n the hn disappear and just still in the database Jon where i should continue the name myself because there no one similar in the database
Thank a lot
Assaf
|
|
|
|
|
All you need to is to use regular expressions or wild cards and pass the typed character to the reglar expression that searchs records in the database and your query returns the search criteria
LIKE %John% will search simliar names with John or Jane
|
|
|
|
|
Can I have an example or where i should search for, Please
Thanks for your help
Assaf
|
|
|
|
|
If this is a web app, search here and google for AutoCompleteExtender.
If it is a WinForm, which I don't know, but you should be able to catch the KeyUp / KeyDown / KeyPress event (which ever is suitable), retrieve the text entered by the user from the textbox, perform your search and populate the textbox with the relevant result.
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"I haven't spoken to my wife now for 48 hours. I don't like to interrupt her.
|
|
|
|
|
Hi guys,
I created a datagridview to view and add/upadate/delete data from sqlserver...bud it does add everything without checking whether the data exist in the database or not...how can i do this check?
|
|
|
|
|
Are you writing SP to update the data? you can check
select count(*) from db where <condition> and check if it already exists.
Are you trying to update the entire gridview data at once? Can you send the code?
|
|
|
|
|
Djavid j wrote: I created a datagridview to view and add/upadate/delete data from sqlserver...bud it does add everything without checking whether the data exist in the database or not...how can i do this check?
May, Optimistic Concurrency[^] rescue you. If so, also take a look at this[^]
________________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
there is an application with .sln only. I need to have the project file, .csproj also. How can I do this?
|
|
|
|
|
Open the solution in Visual Studio, create a new csproj file via Add->New Project, then add your source files to that project.
|
|
|
|
|
I opened in vs and tried to add new project, but visual C# shows only windows and office types, how can I add a web app as the project?
I created the web app sln by going through File->New Website because file->project does not show web application at all.
Please help
|
|
|
|
|
I built a custom control 'ChooseBox' that inherits from ComboBox. When I select an item from a choosebox control, the text in the textbox cannot be seen because of the blue selected text color. If I click away, the selected text is there. I can't see anything wrong with my code. I know this is probably a simple q. Here is the code. Can anybody help?
arevans
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using UtilityCode;
namespace WindowsControlLibrary
{
public class ChooseBox : ComboBox
{
public ChooseBox()
{
this.CausesValidation = true;
this.GotFocus += new EventHandler(ChooseBox_GotFocus);
this.LostFocus += new EventHandler(ChooseBox_LostFocus);
this.DropDown += new EventHandler(ChooseBox_DropDown);
this.Font = new Font("Andale Mono", 11F, FontStyle.Regular);
} // constructor
void ChooseBox_GotFocus(object sender, EventArgs e)
{
this.BackColor = Color.Yellow;
this.Font = new Font(this.Font, FontStyle.Bold);
} // method: GotFocus
void ChooseBox_LostFocus(object sender, EventArgs e)
{
this.BackColor = Color.White;
this.Font = new Font(this.Font, FontStyle.Regular);
} // method: LostFocus
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
bool retValue = base.ProcessCmdKey(ref msg, keyData);
const int WM_KEYDOWN = 0x100;
const int WM_SYSKEYDOWN = 0x104;
if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
{
switch (keyData)
{
case Keys.Down:
SendKeys.Send("{TAB}");
retValue = true;
break;
case Keys.Up:
SendKeys.Send("+{TAB}");
retValue = true;
break;
case Keys.Enter:
SendKeys.Send("{TAB}");
retValue = true; // setting retValue =true here prevents a beep
break;
}
return retValue;
} // method: ProcessCmdKey
void ChooseBox_DropDown(object sender, EventArgs e)
{
this.BackColor = Color.White;
this.Font = new Font(this.Font, FontStyle.Regular);
}
}
}
|
|
|
|
|
You could override the OnPaint method, and check to see the bounds of the selected item, then redraw the text using a white font after base.OnPaint is done. I don't see any more obvious way to accomplish that, but let us know if you find one.
Jeff
|
|
|
|
|
I cannot seem to figure it out. The default value is not working because it still comes up in bold in the property window.
private System.Collections.ArrayList _Test;
[DefaultValue(null)]
[Editor(typeof(TestCollectionEditor), typeof(System.Drawing.Design.UITypeEditor))]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public System.Collections.ArrayList Test
{
get
{
if (_Test == null)
_Test = new System.Collections.ArrayList();
return _Test;
}
set { _Test = value; }
}
I have tried....
[DefaultValue("")]
[DefaultValue(-1)]
Chris
|
|
|
|
|
What is it you want to happen? Not show up bolded in the properties window of Visual Studio? Or not show up at all in the Visual Studio properties window?
|
|
|
|
|
I dont want it to show up in bold.
|
|
|
|
|
I have a simple site allows someone to register to download a help file. It has 3 pages:
The main page has the form fields, with a button for submitting that has an onclick event.
The code behind page has the onclick code for the button click. Once this processes, it forwards to the download page.
the Download page has a clickable link to download the pdf file.
Simple, right? ... Well the problem is, if the user hits the back button from the download page, the Click event is still active and the registration code runs again, then redirects back to the download page.. so the user hits back again.. and the loop continues... I have ended up with 8-10 copies of a user.
so I guess I need to clear the click event after processing the registration, before the redirect. But I have been having trouble finding information on how to do this? Is there a quick and easy fix that I am overlooking?
thanks
Sam
|
|
|
|
|
Why don't you just make a link on the registration page that leads to the main page? So if the user wants to go back, they can click that link.
Admitted, the other solution would be better, but this one is very simple and quick to make.
- Virtual1ty
--
"Any fool can learn from his own mistakes, but a wise man learns from mistakes of others"
|
|
|
|
|
The easiest way is to redirect your page to itself. That resets the viewstate, so that going back doesn't cause a refresh of the page load that sent the click event to the code behind.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I'm not positive what you mean. How do I get to the download page if I am redirecting back to the default page? i could add a query string and check that, I suppose and then forward to the download page, but it seem like an odd way to move through what should be a straight forward pageflow...
|
|
|
|