|
hi to all,
how can i send sql server message to my c# application.
exemple :
in a stored procedure i use the RaiseError keyword with a specific number and description.
all i want to do is to get these two informations in my c# application.
does any know how ?
best regards and thanks in advance
fady
|
|
|
|
|
Use a try/catch and handle the SqlException?
|
|
|
|
|
Hello there.
I was wondering if anyone know if there exist a way to iterate through your named ranges? All I seem to find is:
(Excel.Range)App.get_Range("test", Type.Missing);
Where "test" would be a named range I've specified before manually. I would love to find some easy method like :foreach(NamedRange in ..) etc. So it iterates through all my previously defined names, for example test, test1, test2 etc.
I'm also having large troubles actually getting the name "test" out of anything. rng.Name only gives the address to the range.
I would like this because I want to iterate through all named ranges, sending the name of the range to a webservice and depending on what I would get back I would set a value. Right now I will need to code every specifik instance of them and that will make it harder to add things.
Thanks Christer.
|
|
|
|
|
I'm going insane trying to fix this exception.
I'm building a Browser Helper Object that makes uses of a library that uses GDK-sharp for image handling. GDK-sharp then uses glib-sharp, which then loads libglib-2.0-0.dll so that it can use some of its marshalling code as an extern.
At runtime I get a DllNotFoundException at the point where the DLL is imported into glib-sharp. It claims it can't find libglib-2.0-0.dll. But that DLL is in fact in my path. If I run Filemon it shows the iexplore.exe process successfully loading libglib-2.0-0.dll and its dependencies. Dependency Walker claims I have no missing dependent DLLs. I can't see what could be going wrong here.
One thing might be a lead. When I run it connected to the debugger I get the following error message:
'iexplore.exe': Loaded 'C:\GTK\2.6\bin\libglib-2.0-0.dll', No symbols loaded.
'iexplore.exe': Loaded 'C:\WINDOWS\system32\iconv.dll', No symbols loaded.
First-chance exception at 0x7c964ed1 in iexplore.exe: 0xC0000139: Entry Point Not Found.
I've tried uninstalling and reinstall glib and gtk, but that didn't solve my problem.
Help!
Thanks in advance,
Chris Metcalf
|
|
|
|
|
Hello,
i have a problem with Events ....
i have to use C# and send events to a COM interface
i would like to activate this events by this C#.dll or also through the same COM interface
the COM comunications works but it dosn't fire an event ...
for the test i use a client written in VB6
i would be nice when you can me give any help
(i working with .NET 2003 / VS6.0 on a XPpro)
i have the feeling that ACCOMEvt(src, DateTime.UtcNow); dosn't work rigth ...
here my Code for the server:
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace ACEvt
{
public delegate void ACDelegate(string Source, DateTime TimeStamp);
[Guid("AC4C1820-04B6-4988-928F-FD858B95C880")]
public interface ACCOMInterface
{
[DispId(1)]
DateTime getACTimestamp();
[DispId(2)]
void ActivateACCOMEvt(string source);
}
[Guid("ACC976E0-C208-4740-AC42-41212D3C34F0"),
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ACCOMEvents
{
void ACCOMEvt(string src, DateTime TimeStamp);
}
[Guid("AC5E5FB2-219D-4ee7-AB27-E4DBED8E123E"),
ClassInterface(ClassInterfaceType.None),
ComSourceInterfaces(typeof(ACCOMEvents))]
public class ACCOM : ACCOMInterface
{
public event ACDelegate ACCOMEvt;
public ACCOM()
{
//must be empty !!!!
}
public DateTime getACTimestamp()
{
MessageBox.Show("getACTimestamp");
return DateTime.UtcNow;
}
public void ActivateACCOMEvt(string src)
{
MessageBox.Show("ActivateACCOMEvt");
ACCOMEvt(src, DateTime.UtcNow);
}
}
}
and the VB6 Client without the form:
Option Explicit
Dim WithEvents bmw As AC_Evt.ACCOM
Private Sub Form_Load()
Set bmw = New AC_Evt.ACCOM
End Sub
Private Sub TimeStampBtn_Click()
EvtLst.AddItem bmw.getACTimestamp(), 0
End Sub
Private Sub ActEvtBtn_Click()
bmw.ActivateACCOMEvt ("ActEvtBtn")
End Sub
Private Sub bmw_ACCOM_Evt(ByVal src As String, ByVal Timestamp As Date)
EvtLst.AddItem ">" & src & " " & Timestamp, 0
End Sub
skai007
|
|
|
|
|
Hi,
While reading through many informative articles regarding controls, transparency and alike on C#.
One question remained un-answered every time. How to implement real transparency rather than a fake one.
What is implemented in all the articles is fake, in sense they paint the background of the form, rather than the other controls that are placed underneath the control having transparency.
I myself is quite locked into same situation, and still haven't found no solution.
Compositing mode also didn't help.
Any ideas how to procede and have real transparency enabled.
Thanks.
Jaswinder Singh Kohli
|
|
|
|
|
true transparency is only supported by top level windows (forms)
using "LayeredWindows" api
//Roger
|
|
|
|
|
Hello,
After I retreive the row from the dataset using the select statement:
DataRow[] rowval = dataset.Tables["Versions"].Select("ProjectID = 6 and VersionNumber = 2");
I update some of the values in this row:
rowval[0]["ProjectName"] = "Hello";
rowval[0]["EmployeeID"] = 23;
.
.
.
etc...
How can I insert it back into a dataset, so I can use the update statement
to save the changes into database:
adapterVersions.Update (dataset, "Versions");
Thank you very much
|
|
|
|
|
zaboboa wrote:
How can I insert it back into a dataset,
You don't.
What you get is a reference to a DataRow object. This same reference is contained in the Rows collection of the DataTable in the DataSet .
So, effectively, there's only one row object, and if you modify it somewhere, everybody who has a reference to that particular object will see the changes. In this case, since the DataTable (DataSets don't contain rows) has a reference to the same row you have, it will see the changes. You get the actual row, not a copy of it.
I hope this helps.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hello guys,
I am trying to create a transparent form using CreateWindowEx() by calling
the unmanaged code. But everytime after the call the returned handle is zero.
i could not figure what is the problem in that...
Here is the code
--------------
[DllImport("User32", SetLastError=true)]
internal static extern int CreateWindowEx ( int dwExStyle, string
lpClassName,
string lpWindowName, int dwStyle, int X, int Y, int nWidth, int nHeight,
int hWndParent, int hMenu, int hInstance, IntPtr lpParam);
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct WNDCLASSEX
{
public uint cbSize;
public uint style;
public long lpfnWndProc;
public int cbClsExtra;
public int cbWndExtra;
public long hInstance;
public long hIcon;
public long hCursor;
public long hbrBackGround;
public string lpszMenuName;
public string lpszClassName;
public long hIconSm;
}
[DllImport("User32.Dll")]
public static extern int RegisterClassEx(ref WNDCLASSEX wndcls);
[DllImport("user32.dll")]
public static extern int ShowWindow(long hwnd, int nCmdShow);
private string classname = "TestYetTransparency";
private void init()
{
// Let's create a window
IntPtr
hInst=Marshal.GetHINSTANCE(System.Reflection.Assembly.GetExecutingAssembly().GetModule("TestYetTransparency.exe"));
WNDCLASSEX wndclass=new WNDCLASSEX();
wndclass.cbSize = (uint) Marshal.SizeOf(typeof(WNDCLASSEX));
wndclass.style = 11; //CS_HREDRAW+CS_VREDRAW+CS_DBLCLKS;
wndclass.lpfnWndProc = 0;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInst.ToInt32();
wndclass.hIcon = 0;
wndclass.hCursor = 0;
wndclass.hbrBackGround = 0;
wndclass.lpszMenuName = "TestYetTransparency";
wndclass.lpszClassName = classname;
wndclass.hIconSm = 0;
int mm = RegisterClassEx(ref wndclass);
int nativeHandle = CreateWindowEx(WS_EX_TRANSPARENT,classname,"transparent"
,WS_BORDER,0,0,Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height
,0,0,hInst.ToInt32(),IntPtr.Zero);
ShowWindow(nativeHandle,5); //SW_SHOW
}
private int WS_EX_TRANSPARENT = 0x00000020;
private int WS_BORDER = 0x800000;
------------------
Anyway help in this regard is highly appreciated.
thanks
|
|
|
|
|
Why don't you just use the Form.Opacity property?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Actually let me explain the problem in detail. Actually i am developing an ink based application. So i need to develop a transparent form where on which i can write on it. But when i set the opacity even the ink is becoming transparent. So i thought not to use this property.
I read somewhere in other groups that when a form is created it is created normarly with out WS_EX_TRANSPARENCY property set. Even setting the opacity does not set the value. So i thought of creating a form of this type and can write on it.
I hope this explains quite a bit why i am looking forward in this direction.
vinod
|
|
|
|
|
I don't know how to use Threads in C#.
I want to check if a website is loaded or not. If not loaded, wait for 3 secs and check again. If still not loaded do something.
Please help me with some pointers.
Thanks in advance
Vishal...
|
|
|
|
|
In C# there are function pointers which are nothing but DELEGATES
so delegates, which is used to reference to your objects.
With asynchronous programming, the caller must define the delegate when calling a method, if the caller uses a delegate.
mahes
|
|
|
|
|
Look for the Thread class in the System.Threading namespace. Creating a thread is as simple as instantiating a new Thread instance and calling Start on it.
You might also want to look into the BeginInvoke method, which you can call on any delegate.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
In Form1.cs I have defined the "InstituteAdministrator" class which contains ListView "listViewAddress". In a second file (FormTreeView.cs) I have the class FormTreeView with the method "dataTreeView1_AfterSelect". When the user selects a node in the treeview, then listViewAddress should be filled and displayed with the corresponding addresses.
As long as I keep the whole thing in one file, it works fine, but not with two files and two classes.
I want to use dotnetmagic.com's libraries, which come with this two-files example for docking.
First I created a method within the InstituteAdministrator class which establishes the database connection and fills the listview. Within FormTreeView class I made a reference to the Institute Administrator class and called the filling method I defined, passing "e.Node.Tag.ToString()" as parameter to the method.
The program seemed to work, however the data is not displaying in the listview. Since then I'm trying out (try and error...). So far I did not find sufficient information in books or online examples to help me to understand what is going on. (needless to say that I'm a newbie)
Which are the steps to make this work? Any hints, anyone?
Link to screenshots and source-files:
http://www.osswald.com/vstudio/[^]
Direct link to source files (flash-paper prints):
http://www.osswald.com/vstudio/images/form1.cs.swf[^]
http://www.osswald.com/vstudio/images/FormTreeView.cs.swf[^]
|
|
|
|
|
Hello,
I have a combobox, which is a DropDownList (can't type inside the box)
with values: a, b, and c for example. Is there an event, that will be triggered only when the text changed, if value of combobox was a and new value is b, fire event. However, if value was a and user picks a again, don't fire event.
Thank you.
|
|
|
|
|
DropDown event Occurs when the drop-down portion of a ComboBox is shown.
we can use the event when the text changed in the combobox.
This event is raised if the Text property is changed by either a programmatic modification or user interaction.
private void currencyTextBox_TextChanged(object sender, EventArgs e)
{
try
{
// Convert the text to a Double and determine if it is a negative number.
if(double.Parse(currencyTextBox.Text) < 0)
{
// If the number is negative, display it in Red.
currencyTextBox.ForeColor = Color.Red;
}
else
{
// If the number is not negative, display it in Black.
currencyTextBox.ForeColor = Color.Black;
}
}
catch
{
// If there is an error, display the text using the system colors.
currencyTextBox.ForeColor = SystemColors.ControlText;
}
}
mahes
|
|
|
|
|
I'm new bie to C# application..here is my requirement goes,
(a) I want to search a particular keyword inside a file.
(b) let say, if a file contains text "this is sample program...". If i search "sample" inside a file, it should give the exact matching.
(c) any prior articles for the same..?
-------code
FileStream fs = new FileStream("C:\\a.txt", FileMode.Open, FileAccess.Read);
StreamReader fs1 = new StreamReader(fs);
String mystring="sample";
while (string == fs1. _ ___ )
{
Messagbox.show("Yes i got ur string ..");
}
---------
please reply this incomplete prog..snippet.
|
|
|
|
|
Read N chars (N = length of the string you're matching) from the filestream into a test string. Test the buffer against the search string. If they don't match delete the leading character from the test string, read a single character from the file, append it to the test string and test again. repeat until you find a match or reach the end of the file.
|
|
|
|
|
public bool FindMyText(string text)
{
// Initialize the return value to false by default.
bool returnValue = false;
// Ensure a search string has been specified.
if (text.Length > 0)
{
// Obtain the location of the search string in richTextBox1.
int indexToText = richTextBox1.Find(text);
// Determine whether the text was found in richTextBox1.
if(indexToText >= 0)
{
returnValue = true;
}
}
return returnValue;
}
mahes
|
|
|
|
|
|
I have a combobox and is populated from a datatable. The problem is that I have in my table rows with the same value for that column so I want that in combobox to appear that values only once because when I select a value from the combobox my datagrid to display only the lines with that value in the specified column. The combobox stores the months and in my datagrid I want to display the items from that specified month. I will show my code below:
public FModificareDate()
{
InitializeComponent();
conAccess.Open();
daMembrii.Fill(odsDate, "tb_membrii");
daUnitate.Fill(odsDate,"tb_unitate");
DataTable dataTableMembrii = odsDate.Tables["tb_membrii"];
#region Definire coloane datagrid Membrii
//Setarea numelor coloanelor din datagrid
// create a DataGridTableStyle object and initialize
// based on the dataTable's TableName.
DataGridTableStyle tableStyleMembri = new DataGridTableStyle( );
tableStyleMembri.MappingName = dataTableMembrii.TableName;
// Get the GridColumnsStylesCollection
// from the table style's GridColumnStyles collection
GridColumnStylesCollection columnStylesMembri = tableStyleMembri.GridColumnStyles;
// Make a columnStyle object and add column info to it
// then add the columnStyle to the columnStyles collection
DataGridColumnStyle columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_codcmr";
columnStyleMembri.HeaderText = "Cod CMR";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_codparafa";
columnStyleMembri.HeaderText = "Cod Parafa";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_cnp";
columnStyleMembri.HeaderText = "CNP";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_nume";
columnStyleMembri.HeaderText = "Nume";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_prenume";
columnStyleMembri.HeaderText = "Prenume";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_luna";
columnStyleMembri.HeaderText = "Luna";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_an";
columnStyleMembri.HeaderText = "Anul";
columnStylesMembri.Add(columnStyleMembri);
columnStyleMembri = new DataGridTextBoxColumn( );
columnStyleMembri.MappingName = "pers_suma";
columnStyleMembri.HeaderText = "Suma Totala";
columnStylesMembri.Add(columnStyleMembri);
GridTableStylesCollection tableStylesMembri = dgMembri.TableStyles;
tableStylesMembri.Add(tableStyleMembri);
#endregion
dgMembri.DataSource = dataTableMembrii;
DataTable dataTableUnitate = odsDate.Tables["tb_unitate"];
#region Definire coloane datagrid Unitate
// create a DataGridTableStyle object and initialize
// based on the dataTable's TableName.
DataGridTableStyle tableStyleUnitate = new DataGridTableStyle( );
tableStyleUnitate.MappingName = dataTableUnitate.TableName;
// Get the GridColumnsStylesCollection
// from the table style's GridColumnStyles collection
GridColumnStylesCollection columnStylesUnitate = tableStyleUnitate.GridColumnStyles;
// Make a columnStyle object and add column info to it
// then add the columnStyle to the columnStyles collection
DataGridColumnStyle columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "unit_id";
columnStyleUnitate.HeaderText = "ID";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "unit_tip";
columnStyleUnitate.HeaderText = "Tip";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "unit_denumire";
columnStyleUnitate.HeaderText = "Nume Unitate";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_tara";
columnStyleUnitate.HeaderText = "Tara";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_secjud";
columnStyleUnitate.HeaderText = "Sector/Judet";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_localitate";
columnStyleUnitate.HeaderText = "Localitate";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_tip";
columnStyleUnitate.HeaderText = "Tip Adresa";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_denumire";
columnStyleUnitate.HeaderText = "Denumire";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_codpostal";
columnStyleUnitate.HeaderText = "Cod Postal";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_nr";
columnStyleUnitate.HeaderText = "Nr";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_bloc";
columnStyleUnitate.HeaderText = "Bloc";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_scara";
columnStyleUnitate.HeaderText = "Scara";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_etaj";
columnStyleUnitate.HeaderText = "Etaj";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_apartament";
columnStyleUnitate.HeaderText = "Apartament";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_compladresa";
columnStyleUnitate.HeaderText = "Completari Adresa";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_fix1";
columnStyleUnitate.HeaderText = "Telefon Fix1";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_fix2";
columnStyleUnitate.HeaderText = "Telefon Fix2";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "adr_fax";
columnStyleUnitate.HeaderText = "Fax";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "persc_nume";
columnStyleUnitate.HeaderText = "Nume Persoana Contact";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "persc_prenume";
columnStyleUnitate.HeaderText = "Prenume Persoana Contact";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "persc_tel";
columnStyleUnitate.HeaderText = "Telefon Persoana Contact";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "ind_nr";
columnStyleUnitate.HeaderText = "Indicator control";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "ind_tot";
columnStyleUnitate.HeaderText = "Total";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "ind_luna";
columnStyleUnitate.HeaderText = "Luna";
columnStylesUnitate.Add(columnStyleUnitate);
columnStyleUnitate = new DataGridTextBoxColumn( );
columnStyleUnitate.MappingName = "ind_an";
columnStyleUnitate.HeaderText = "Anul";
columnStylesUnitate.Add(columnStyleUnitate);
GridTableStylesCollection tableStylesUnitate = dgUnitate.TableStyles;
tableStylesUnitate.Add(tableStyleUnitate);
#endregion
dgUnitate.DataSource = dataTableUnitate;
txtMembri.Text = dataTableMembrii.Rows.Count.ToString();
dSumaCotizatii = 0;
for(int i=0; i
|
|
|
|
|
Hi,
I am working on the treenodes in C# and am facing a prob. I want to dynamically populate treenode with a filename immediately after saving a file in a particular folder. Can I do this without writting any seperate function.
Or is there any other way?.
Looking forward for some help.
Thanks and Regards
KR
|
|
|
|
|
Hi All,
I was not able to display complex classes in the propertygrid and hence had to use UITypeEditors for doing that.
I am actually trying to display the properties of a class object inside the property grid which has another class object as one of its property .(can go deep)
The problem is that the object which is the property is getting grayed out even though i am using UITypeEditor (Comboboxlisteditor) to do so.
So no point in thinking of more deeper object properties.
I have tried all places to search for such a code which has a propertygrid displaying complex classes and enums . I could not find one .
So please spare some time and pass on some simple code which can display complex class objects and enums inside the propertygrid .I just need the minimum . I have referred to MSDN and few other articles from codeproject which was helpful to a certain extent but not for this problem .
I have spent more than 3-4 days in researching the things on this .
Please help me in getting it done .
Thanks and Regards,
DJ
|
|
|
|
|