|
InOut.NET wrote: How can I disable the 'ding' when using the ENTER key?
Check ur Control Panel>>Sound settings.
|
|
|
|
|
programmatclly. I don't want to disable the sound globally, just for the control.
|
|
|
|
|
You need to catch the control's KeyPress event and set the Handled property of the KeyPressEventArgs to true:
private void comboBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar == 13)
e.Handled = true;
}
|
|
|
|
|
|
Hi for all!
I have some problem, while try to read and copy locked or files witch in use.
I try this method, witch work for some file, but the others not
my way:
<br />
FileStream fs = null;<br />
<br />
try<br />
{<br />
try<br />
{<br />
fs = File.OpenRead(file);<br />
}<br />
catch<br />
{<br />
fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.Read);<br />
}<br />
}<br />
catch<br />
{<br />
try<br />
{<br />
string NewFile=File+"_";<br />
Fi.CopyTo(NewFile, true);<br />
}<br />
catch<br />
{<br />
try<br />
{<br />
File.Copy(file, NewFile, true);<br />
}<br />
catch<br />
{<br />
}<br />
}<br />
} <br />
}<br />
catch (Exception e)<br />
{<br />
MessageBox.Show("Grrrrrr: "+e.Message);<br />
}<br />
I miss somethink, or I need a nother way to figure out windows file locking system.
I wait for any ideas....
Thank's for help.
|
|
|
|
|
Try to copy first and then open the new file.
For example :
You have a file "hello.txt". Then you can lock it using
FileStream fStream = new FileStream("hello.txt", FileMode.Open);
If you try to copy it, it works... File.Copy("hello.txt", "hello_1.txt");
Then just open "hello_1.txt".
|
|
|
|
|
Thanks stancrm!
It was the first think I try. But some files it not works. Exampl MS Outlook .pst files can't copy, while Outlook is open.
|
|
|
|
|
I think it is write. It is the reason, why you cannot copy .pst file, if the file is open.
It because of inconsistence reason somehow.
|
|
|
|
|
And is there any method to copy these files?
How about the unlocker programs, how they do it?
|
|
|
|
|
I don't think so...
I've never heard about unlocker program.
|
|
|
|
|
Thaks for your answers!
I hope someone can help me solve this problem.
I think (and hope) is there a comand line util or an assemby program, witch can do anithing with a file, witout the permisson of windows...
PS.:
here you can find some "magic" program , they said, can unlock locked, or in used system or other files...
|
|
|
|
|
Iam developing a SDI windows application where i will have lot of user controls and one form(main) with panel. whenever the user clicks some buttons in form i have to load the corresponding user control into the panel. here i have a need every user control needs access the forms controls like when i click cancel on user control it should remove itself from panel and should load the next user control.
Now currenly i implemented this as the mainform class will create all user control object and pass this(mainform) as a refrence to all usercontrol constructors. so that all user control can access Form's panel to load/unload the usercontrol.
My question : Is design Ok. passing mainform reference to all usercontrols?
or any other way to do it.
Like i have one more idea instead of passing mainform reference every usercontrol will expose one event, mainform should register that event. whenever the usercontrol wants to remove itselft/load another one it has to send the nextusercontrol name as argument event and has to trigger tha event. so the mainform will process the event and unload/load the usercontrol from panel.
From the two apporached i don't which one is correctly. If you guys have some ideas. pleas suggest me.
Thanks and Regards
Srini
|
|
|
|
|
Hi,
both designs are correct and according to some situation one of them will
work better (desing wise i mean). If both work you can choose which one to use.
However, i the first case you should work with an interface instead of passing
the full form to it. This way you can't call any other non usercontrol related
functions from in the usercontrol. This is an better design.
codito ergo sum
|
|
|
|
|
If i understand you correctlly, you acctaully want a MDI-alike interface without the forms.
I've done the same thing (but with MDI forms) and found that a control/form should not unload itself. I prefer a "control marchall" in the main form that cooridnates the creation and disposal of the controls. I use this approach and gives my comlete control over the opened controls. The main form hold the custom control object, and main form can access it when something within the mainform changes and affects the currentlly open controls. The control/form communicates with the mainform using events and mainform cummunicates with the custom control trough public methods. Perfectly 2-way comm bewteen the 2 objects while none is dependant on the other.
engsrini wrote: when i click cancel on user control it should remove itself from panel and should load the next user control.
I use a event that thats fires within the contol when the cancel button is pressed. OnControlRequestClose(object sender).
This event is consumed by the control marchall in the main form and the control marchall then calls the public methods that stop threads running on the control and then safelly control.close();
I your case you can control the next control order from a central entity.
Both your appraches are feasible, but having a marchalling entity makes it so more flexible. The reason i took this road is that my mainform acts as a central management entity that does Audit trails, indicate network comms, log files, handle form malfunctioning and a few more functions that is commonly used troughout my system. I hate copying and pasteing the same code in each form, thus i use the central entity with a combonation of events and custom delegates.
This works fine for me. No refrence of the main form goes to the control. The main form however must 'know' the type of the custom control.
My opinion,
Andre
|
|
|
|
|
Hi,
My requirement is to set combobox column for deptno column of the table dept.
When insert button is clicked,i write the following code
DataGridViewComboBoxColumn cell = new DataGridViewComboBoxColumn();
cell.DataPropertyName = "DEPTNO";
cell.HeaderText = "dno";
cell.Items.Add(10);
cell.Items.Add(20);
cell.DataSource = ds.Tables["dept"];
cell.ValueMember = "DEPTNO";
cell.DisplayMember = "deptno";
dataGridView1.Columns.Add(cell);
dt=new DataTable();
dt = (DataTable)dataGridView1.DataSource;
DataRow dr = dt.NewRow();
dt.Rows.Add();
dataGridView1.DataSource = dt;
My problem is that combobox column is displayed as a separate column.But it value member set to deptno column of dept table.And when i select 30 from that combo box control goes to deptno=30 row.
I want combox cell is set for deptno column and when we select a value from that combo box column the velue is displayed for that row.
How to do this.
Thanks in advance.
|
|
|
|
|
kalkumar wrote: cell.ValueMember = "DEPTNO";
cell.DisplayMember = "deptno";
Display member is the one that's displayed onscreen, the value member represent the underlying value.
Example:
2 colums in table DEPNO (int) and DEPDESC (string).
Valuemember = DEPNO
Displaymember = DEPDESC
this will display the DEPDESC string in the combobox, but when you select a item the combobox returns the DEPNO and not the DEPDESC.
ps:
i get confused witch one is witch. Valuemember may be the one thats displayed and displaymember may be undelying value.
i think this is what you asked
Andre
|
|
|
|
|
Hello folks,
What's the equivalent of BSTR* in .NET (C#)
I used string and it gave me memory error. I used String and nothing gets returned.
The following is the declaration in C++ header file:
extern DllImport short int WINAPI ReceiveResponse(short int, short int, LONG, short int, BSTR*, BSTR*, BSTR*);
extern DllImport short int WINAPI ReceiveData(short int, short int, BSTR*, short int*);
The following is how the two functions declared in VB6 which works perfectly:
Declare Function ReceiveResponse Lib "some.dll" _
(ByVal a As Integer, _
ByVal b As Integer, _
ByVal c As Long, _
ByVal d As Integer, _
ByRef e As String, _
ByRef f As String, _
ByRef g As String _
) As Integer
Declare Function crwReceiveData Lib "some.dll" _
(ByVal a As Integer, _
ByVal b As Integer, _
ByRef c As String, _
ByRef d As Integer _
) As Integer
The following is how I declared it in C# which doesn't work:
[DllImport("some.dll")]
public static extern int ReceiveResponse (
int a, int b, int c, int d,
String e
String f,
String g );
[DllImport("some.dll")]
public static extern int ReceiveData(
int a, int b, String c, int d);
If the way I declare in it C# looks good, I don't know why it didn't work. Perhaps somebody could help me out.
Thanks,
Tony
|
|
|
|
|
try out
[DllImport("some.dll")]
public static extern int ReceiveResponse (
int a, int b, int c, int d,
ref String e
ref String f,
ref String g );
it might help out.
rahul
|
|
|
|
|
DOH!
of course!
Thanks. It works now
-Tony;P
|
|
|
|
|
Try this:
using System.Runtime.InteropServices;
[DllImport("some.dll")]
private static extern int ReceiveResponse(int a, int b, int c, int d,
[MarshalAs(UnmanagedType.BStr)] ref string e,
[MarshalAs(UnmanagedType.BStr)] ref string f,
[MarshalAs(UnmanagedType.BStr)] ref string g);
|
|
|
|
|
hai,
iam capturing a image and storing the image in the database as binary format and also able to retrieve the image. once i edit the image and save the image its saving but sometimes its showing length of large bytes and also once edited and updated iam unable to retrieve the image , its giving out of memory error. i will show my updating code .pls help me....
SQL="Update VisitorPhoto set ID='"+ txtVisitorID.Text.Trim() + "',";
SQL+=" Length='" + m_lImageFileLength + "',";
SQL+=" Picture='" + m_barrImg+ "',";
SQL+=" Type='" + '1'+ "',";
SQL+=" upsize_ts='" + DateTime.Now.ToString("dd/MM/yyyy hh:mm:sstt") + "'";
SQL+=" where ID='"+ txtVisitorID.Text.Trim() + "'";
Db.Execute_Non_Query(SQL);
|
|
|
|
|
You should use blob operations. Do something like this:
SqlCommand command= new SqlCommand("UPDATE bla VALUES (@picture)",connection);
command.Parameters.Add("@picture", SqlDbType.Image, m_lImageFileLength).Value = m_barrImg;
ADO.NET then takes care of your picture in the correct way because you definied the correct type (SqlDbType.Image)
|
|
|
|
|
hai thank u for ur reply. i got it and updated using stored procedure.
|
|
|
|
|
Hi
Can anyone help me out in adding a design script to a script component in SSIS using C#
Tarsha
|
|
|
|
|
Dear All,
How do i read the database name and File Size and File growth Which i will provide in the XML File
How do extract the only the dbname from the XML File i specified here.
like
<xml>
<databasename>
<id> dbname
<name> shiv
<filesize>
<id> size
<value> 10
With GreatRegards,
Siva
|
|
|
|
|