|
My code did not create the file. Another application did and it closes the file and exits, so I know it didn't lock the file.
Is there a native Windows API that I can call to get the process name/handle of the process that has locked the file?
|
|
|
|
|
Hi all. I am developing my desktop application in C# 2005. I have a File menu. In its submenu , i have OBTAIN API. I want when i click on it, it redirects me to the desired site like www.google.com. Please tell me how to call a specific website from the desktop application? Thanks a lot for your consideration.
|
|
|
|
|
If you pass a URL to Process.Start, it will open the site in your default browser.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I have tried this:
private void tsmi_obtainAPI_Click(object sender, EventArgs e)
{
Process.Start("www.google.com");
}
it returns the following error:
The name "Process" doesn't exist in the current context. Would you please help me out in this? Thanks
|
|
|
|
|
System.Diagnostics.Process.Start, apparently.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks a lot Graus, it works now. I am really thankful to you
|
|
|
|
|
Hi,
process1.StartInfo.FileName="iexplore";
process1.StartInfo.Arguments="NishuSoft.com";
process1.Start();
<marquee>nishu
|
|
|
|
|
Hi guys,
I am trying to use ReturnCodes in my application and I am getting an error saying the type or namespace name 'Return Codes' could not be found(Are u missing a Using directive or an Assembly reference?)
any suggestions please
sasa
|
|
|
|
|
|
What are you trying to suggest here?
sasa
|
|
|
|
|
That you need to learn some basic stuff and it will be in those tutorials.
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
Thank you Mike, you are good man
sasa
|
|
|
|
|
What exactly are you trying to do?
If you want to return a code from your application change the signature of your application to static int Main() .
If that's not what you want, please show the related code especially the line with the given error.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I am trying to get the ReturnCode for an smtp mail that I am sending and if the mail doesn't go through than use a while loop to keep trying until it goes through.
SmtpMail.Send(msg);
sasa
|
|
|
|
|
AFAIK there is no return code so you will be out of luck here.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi there!
Please help, I am totally lost on this one. I have a service application that sends out emails every minute based on a sql output. The weird thing is I get 4-5 emails and then I get the above error and then again I get 4-5 mails and again get the above error.
Any suggestions please.
sasa
|
|
|
|
|
I am trying to accomplish Kerning, so far I have it somewhat working. By using the win32 function
[DllImport("gdi32.dll", EntryPoint= "SetTextCharacterExtra")]<br />
public static extern int SetTextCharacterExtra(IntPtr hdc, int nCharExtra);
I am getting spacing between characters. The issue is no matter what value I put for the nCharExtra parameter the spacing is always the same.
Here is how I am trying to do it.
win32.SetTextCharacterExtra(g.Graphics.GetHdc(), horizontalSpacing);<br />
g.ReleaseHdc();<br />
g.DrawString(holdText, this.Font, new SolidBrush(this.ForeColor), 0, 2);
I have also tried doing
IntPtr hdc = e.Graphics.GetHdc();<br />
Rect bounds = new Rect(e.ClipRectangle);<br />
<br />
win32.SetTextCharacterExtra(hdc, horizontalSpacing);<br />
win32.SetBkMode(hdc, win32.TRANSPARENT);<br />
win32.SetBkColor(hdc, ColorTranslator.ToWin32(Color.Black));<br />
win32.DrawText(hdc, holdText, holdText.Length, ref bounds, win32.DT_LEFT);
Does anyone know a solution to this issue, or another way in which I can accomplish Kerning?
Thanks,
Jeremy
|
|
|
|
|
hi i just learn c# and i got problem with my window programing i use microsoft acess as my database and i want to connect to my c# and i can connect it the problem is after that i update my database add a new colomn and in c# i cannot acess that new column
can u help me to solve the problem
thanks
|
|
|
|
|
If you start each sentence with a capital letter and end it with a period, it gets much, much easier to understand what you are writing.
What made you come to the conclusion that you can not access the new field?
---
b { font-weight: normal; }
|
|
|
|
|
wow - take a breath !!!
C# can absolutely access any column in your database. As it's access, it's an MDB file, right ? Are you pointing to the right copy, or an old copy that does not have that column ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi for example in first form i type code
string cusername = gempanDataSet.Table1[i].username;
i got the acess file named gempan
and i used it in the first form after that i go to form2 and want to use my database again but it got error
|
|
|
|
|
arifliminto86 wrote: but it got error
Sounds as if you need to post the code, so we can see what you're doing wrong. If the access file has the field in form1, but not in form2, I'd doubt you were using the same database, or perhaps you're not using the same query. You can select only some fields from a table, maybe that's your problem.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data.SqlClient;
namespace anggota
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void cmdexit_Click(object sender, EventArgs e)
{
MessageBox.Show(" BYE ");
Application.Exit();
}
private void cmdok_Click(object sender, EventArgs e)
{
bool matched = false;
bool matched2 = false;
Form f1 = new Form1();
for (int i = 0; i < gempanDataSet.Table1.Count; i++)
{
string cusername = gempanDataSet.Table1[i].username;
string cpassword = gempanDataSet.Table1[i].password;
matched = matched || (txtusername.Text == cusername);
matched2 = matched2 || (txtpassword.Text == cpassword);
if (matched && matched2) break;
}
if (matched)
{
MessageBox.Show("Username Correct");
}
else
{
MessageBox.Show("UNDETECTED username");
txtusername.Text = "";
}
if (matched2)
MessageBox.Show("Password Correct");
else
{
MessageBox.Show("Wrong Password");
txtpassword.Text = "";
}
executef2();
}
private void executef2()
{
Form2 f2 = null;
if (f2 == null)
{
f2 = new Form2();
f2.Show();
}
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'gempanDataSet.Table1' table. You can move, or remove it, as needed.
this.table1TableAdapter1.Fill(this.gempanDataSet.Table1);
}
.................................. this it form 1 and below is form2 called profile
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace anggota
{
public partial class Profile : Form
{
public Profile()
{
InitializeComponent();
}
private void txtfn_TextChanged(object sender, EventArgs e)
{
string cpassword = gempanDataSet.Table1[i].password;
}
private void Profile_Load(object sender, EventArgs e)
{
this.table1TableAdapter1.Fill(this.gempanDataSet.Table1);
}
}
}
can u help me solve thanks
|
|
|
|
|
wow
arifliminto86 wrote: Form f1 = new Form1();
Why ?
arifliminto86 wrote: Form2 f2 = null;
if (f2 == null)
{
f2 = new Form2();
f2.Show();
}
Why ?
arifliminto86 wrote: this.gempanDataSet.Table1
Where is this data set filled ? It has the same name in Form1, but I don't see it being set in either. i.e. I don't see where this object is defined, so you'd expect it to be shared between forms of a different type.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi thanks for helping me.. actuall in form1 i already fill data with this code
this.table1TableAdapter1.Fill(this.gempanDataSet.Table1);
and i want to aplly again in my profile form but it doesnt work out.. do u know what code that i have to put ..?
thanks
form1:
-------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data.SqlClient;
namespace anggota
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void cmdexit_Click(object sender, EventArgs e)
{
MessageBox.Show(" BYE ");
Application.Exit();
}
private void cmdok_Click(object sender, EventArgs e)
{
bool matched = false;
bool matched2 = false;
Form f1 = new Form1();
for (int i = 0; i < gempanDataSet.Table1.Count; i++)
{
string cusername = gempanDataSet.Table1[i].username;
string cpassword = gempanDataSet.Table1[i].password;
matched = matched || (txtusername.Text == cusername);
matched2 = matched2 || (txtpassword.Text == cpassword);
if (matched && matched2) break;
}
if (matched)
{
MessageBox.Show("Username Correct");
}
else
{
MessageBox.Show("UNDETECTED username");
txtusername.Text = "";
}
if (matched2)
MessageBox.Show("Password Correct");
else
{
MessageBox.Show("Wrong Password");
txtpassword.Text = "";
}
executef2();
}
private void executef2()
{
Form2 f2 = null;
if (f2 == null)
{
f2 = new Form2();
f2.Show();
}
}
private void Form1_Load(object sender, EventArgs e)
{
this.table1TableAdapter1.Fill(this.gempanDataSet.Table1);
}
}
}
----------------------------------
form2:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace anggota
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
}
private void cmdaccount_Click(object sender, EventArgs e)
{
}
private void lblprofile_Click(object sender, EventArgs e)
{
executeprofile();
}
private void executeprofile()
{
Profile f2 = null;
if (f2 == null)
{
f2 = new Profile();
f2.Show();
}
}
}
}
-------------------------------------------------
profile :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace anggota
{
public partial class Profile : Form
{
public Profile()
{
InitializeComponent();
}
private void txtfn_TextChanged(object sender, EventArgs e)
{
string cpassword = gempanDataSet.Table1[i].password;
}
private void Profile_Load(object sender, EventArgs e)
{
this.table1TableAdapter1.Fill(this.gempanDataSet.Table1);
}
}
}
|
|
|
|