|
1. Keep a counter and increment it everytime the main page loads
2. Their IP address is available to you within your codebehind as well.
3. To do this, you need to use linkbuttons, so that you can capture the click as opposed to a browse to a page, and then keep another counter.
4. response.redirect, from memory.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
hi , thanks
mey u explain more about:
--getting ip
--open new window for a url from c# code area
thanks again
|
|
|
|
|
Oh - response.redirect will not open a new window. I'm not sure how to do that in code, a link has target = "_blank" to do that, from memory.
Request.ServerVariables("REMOTE_ADDR") will give you the IP address.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi,
For outlook automation with C#, is there a single way of automation
for different version of MS Outlook (97, 2000,xp,2003) ? Or it need to
be done seperately by different methodology ?
Many thanks
|
|
|
|
|
The Oulook Object Model is nearly the same for Outlook 97 and newer versions. Some methods have been added, but none has been removed.
If you develop with Outlook 97 only, the result should run with newer versions, too.
_________________________________
Vote '1' if you're too lazy for a discussion
|
|
|
|
|
Thanks
But while I develop the program in C# VS.NET, I need to add the outlook reference to the project, do I need to add seperate COM reference for different version of Outlook ? Or I just add a single COM reference
(e.g. Microsoft Office 10.0 object library ), then the code can work for different version of outlook ?
And another question is that can I automate Outlook Express by the same automation methodology ?
|
|
|
|
|
g'day all,
i am just writing to seek help on a small problem i am stuck on. at the moment i am learning c# by developing a small application which mimicks the behaviour of a windows folder. The problem I am stuck on is that when I click on a column(either File Name, Dated Created or File Size) to perform a sort, I do not know how to make the background color change of the selected column.
So any code snippets would be most welcome or any hints
thanks
ekynox
|
|
|
|
|
Hi,
Is there any way to refresh the scroll bars of PrintPreviewControl? such that when its container form is resized, the control should recalculate its scroll bars thumb locations automatically and refresh itself with new locations.
please guide.
|
|
|
|
|
I have a DataSet (ds) and I would like to fill a table in it (tbl1) with data coming from SqlDataAdapter (d1) and continue filling it with data coming from different SqlDataAdapter (d2), how can I do this.
Thank very much in advance for any help,
Anonymous
|
|
|
|
|
Hi,
We can do it as you do for single adapter.
adptr = new SqlDataAdapter("select * from employees", connstring);
adptr.Fill(ds,"employees");
adptr2 = new SqlDataAdapter("select * from employeeadd",connstring);
adptr2.Fill(ds,"employeeadd");
It will contain the data from both the tables.
Thankns and Regards
SGS
|
|
|
|
|
1.I need to know how to connect up a dataset
2. take each file from one of the columns
3. check if a duplicate file exists in a directory
4. print those that don't from the master list ( data set) to a text file
HELLLLLPPPPPP!!!!
|
|
|
|
|
1. The web is full of code for this
2. Ditto
3. Path.GetFileName() will give you the filename, and File.Exists ( from memory, could be Path.Exists ) will check for you
4. The web is full of code for this.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
thank you for the reply...Here is my code what is wrong?
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using ContentDistributor.Library.DocIndexing;
using ContentDistributor.Library;
using ContentDistributor.Database;
using System.Data.OleDb;
using System.Configuration.Assemblies;
using System.Configuration;
using System.Text;
using System.IO;
namespace PathDisplay
{
///
/// Summary description for Form1.
///
public class frmDisplay : System.Windows.Forms.Form
{
private System.Windows.Forms.Label lblStart;
private System.Windows.Forms.Label lblEnd;
private System.Windows.Forms.Button btnDisplay;
private System.Windows.Forms.Label lblError;
private System.Windows.Forms.TextBox txtStartDate;
private System.Windows.Forms.TextBox txtEndDate;
private string start;
private string end;
private System.Data.DataSet mysd;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlConnection sqlConnection1;
private System.Windows.Forms.DataGridTableStyle dataGridTableStyle1;
...
static void Main()
{
Application.Run(new frmDisplay());
}
private void txtStartDate_TextChanged(object sender, System.EventArgs e)
{
start = txtStartDate.Text;
}
private void txtEndDate_TextChanged(object sender, System.EventArgs e)
{
end = txtEndDate.Text;
}
private void btnDisplay_Click(object sender, System.EventArgs e)
{
//Declare Reader
SqlDataReader rdr = null;
//
try
{
//Open Connection
// //Intialize Stored Procedure ap_DocLocPathDisp
// SqlCommand command = new SqlCommand("ap_DocLocPathDisp",oSQLConn);
// command.CommandType= CommandType.StoredProcedure;
//
//
// //Add and Declare PARAMS
// command.Parameters.Add("@StartDate", SqlDbType.DateTime).Value = start;
// command.Parameters.Add("@EndDate", SqlDbType.DateTime).Value = end;
// command.Parameters.Add("@PATH", SqlDbType.VarChar).Value = @"E:\Brethren images\ContentDistributor\Published\";
//
// if (oSQLConn.State.Equals(ConnectionState.Closed))
// {
// oSQLConn.Open();
// }
//
// DataSet myds = new DataSet();
// sqlDataAdapter1.Fill ( myds );
// oSQLConn.Close();
//
// DataTable myDTable = myds.Tables["DocPath"];
// SqlConnection oSQLConn = new SqlConnection();
string strCon = @"Server=ITDEV7;Database=CD30;User ID=sa;Password=sa;Trusted_Connection=True";
string strSql="select * from tbldoctest";
SqlConnection con=new SqlConnection(strCon);
con.Open();
SqlDataAdapter dadapter=new SqlDataAdapter();
dadapter.SelectCommand=new SqlCommand(strSql,con);
DataSet dset=new DataSet();
dadapter.Fill(dset);
con.Close();
this.dataGrid1.DataSource=dset;
// foreach( DataRow myDR in myDTable.Rows)
// dataGrid1.DataSource = myDTable;
// dataGrid1.DataMember = "Grid";
{
// rdr = command.ExecuteReader();
// while (rdr.Read())
// {
// string DocDateCreated = (string)rdr["DocDateCreated"];
// string DocIndexID = (string)rdr["DocIndexID"];
// string FilePath = (string)rdr["FilePath"];
// string FILE_NAME = "CheckDOCExist.txt";
// {
// if (File.Exists(FILE_NAME))
// {
// MessageBox.Show("File already exists.","Error",
// MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
//
// return;
// }
// StreamWriter sr = File.CreateText(FILE_NAME);
// //sr.WriteLine ("This is my file.");
// //sr.WriteLine ("I can write ints {0} or floats {1}, and so on.", 1, 4.2);
// sr.Close();
// oSQLConn.Close();
}
}
// }
// }
finally
{
// if (rdr != null)
// {
// rdr.Close();
// }
MessageBox.Show("Thank You","Thank You",
MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
}
}
}
}
|
|
|
|
|
All your code is commented out ?
I dunno, what's going wrong ? Perhaps the fact you set the data source every time inside the loop is a problem ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi everybody,
this isn't a programming problem but more a math problem.
I have to make a program to calculate a schedule for a competition so for example
you got 4 teams playing each other so you get the matches
1-2
1-3
1-4
2-3
2-4
3-4
calculating wich matches has to be played isn't the problem.
The problem is how to calculated in wich round (you got 4 players so 3 round) a match has to be play so no team plays more than once in each round.
in this example it isn't difficult to calculate that:
round 1
1-2
3-4
round 2
1-3
2-4
round 3
1-4
2-3
but with more teams is hard. has anyone got a math formula to calculated this??
|
|
|
|
|
Hi,
I dont know if it is the optimal solution but it should work:
public struct Match
{
public int Team1;
public int Team2;
public Match(int t1, int t2)
{
Team1 = t1;
Team2 = t2;
}
}
object dummy = new object();
int teamsCount = 200;
ArrayList matchesList = GetMatches(teamsCount);
Hashtable tokenMatches = new Hashtable();
for (int i = 1; i < teamsCount; i++)
{
ArrayList matchesInRound = new ArrayList();
Hashtable tokenTeams = new Hashtable();
foreach (Match match in matchesList)
{
if (!tokenMatches.ContainsKey(match)
&& !tokenTeams.ContainsKey(match.Team1)
&& !tokenTeams.ContainsKey(match.Team2))
{
matchesInRound.Add(match);
tokenMatches.Add(match, dummy);
tokenTeams.Add(match.Team1, dummy);
tokenTeams.Add(match.Team2, dummy);
}
}
Console.WriteLine("Round " + i + ": ");
foreach (Match match in matchesInRound)
{
Console.WriteLine(" " + match.Team1 + "-" + match.Team2);
}
}
Its not very elegant. Its up to you to make it clean. I used Hashtables because they provide a rather fast lookup. I think up to about 100 teams should be no problem.
|
|
|
|
|
hey, I have a AutoComplete ComboBox which is binded to a database for searching for users.
I have it binded and its doing the autocomplete well, only problem is upon launch its filling the first field as the first field in the databind list when I want it to say "search users"
Just wondering how I make it start at position0 and then auto complete from there after.
[code]
//opens the connection
Open();
DataSet ds = GetDataSet("SELECT * FROM Employee_Records", "Employee_Records");
//Bind the DataSet names to the Search Combo Box
cmbSearchEmp.DisplayMember = "Employee_Records.userName";
cmbSearchEmp.DataSource = ds;
[/code]
Thanks!
|
|
|
|
|
Hello, all.
I am trying to implement context-sensitive help using the "Help cursor" functionality. I want to be able to handle the HelpRequested event generated when the user clicks on a control using the Help cursor. I am trying to do this on a top-level form that has to have the Minimize and Maximize buttons available, though, so setting HelpButton to true for the form doesn't make the Help button be displayed.
So, my question is this: Can I do something to make the Form think that the Help button has been clicked, so that it displays the Help cursor and will generate a HelpRequested event when the user clicks on a Control?
Thanks!
|
|
|
|
|
Hi .
How i can catch exceptions in main thread , if they occured in other(child) thread.
THANK
|
|
|
|
|
Run your thread in an application domain. In your main thread subscribe to the UnhandledException event of the app domain and take care of the error there.
<br />
System.AppDomain dom = <your thread's app domain><br />
dom.UnhandledException += new UnhandledExceptionEventHandler(dom_UnhandledException);<br />
}<br />
<br />
private void dom_UnhandledException(object sender, UnhandledExceptionEventArgs e)<br />
{<br />
...<br />
}<br />
|
|
|
|
|
I had a poorly formatted first line in the code snippet. It should read:
<br />
System.AppDomain dom = YourThreadsAppDomain;<br />
|
|
|
|
|
|
For some reason the forward and back buttons on my mouse don't work when I embed the AxWebBrower control into a windows forms project. I am using Visual Studio 2003 and framework 1.1.
The mouse buttons work with IE so I know that the problem is not the mouse...
I've tried catching the onclick and onmousedown events but have had no luck.
Does anyone out there know how to get this to work?
|
|
|
|
|
hello,
i want to get access to an actual shown html page in the internet explorer. does anyone know how i can realize this or give me some keywords i have to search at google?
i want to read the html page and then dynamically change the shown content. maybe this could be made with com?
thanks for some help!
|
|
|
|
|
Use tlbimp.exe to create a COM interop assembly from shdocvw.dll, or - in VS.NET - right-click on your project and click Add Reference. Click on the COM tab and find "Microsoft Internet Controls". Double-click to add an interop assembly to your project. Also repeat this process for mshtml.dll, or "Microsoft HTML Object Library". Add the following to the top of your source file:
using SHDocVw;
using mshtml;
In your code, instantiate the InternetExplorerClass , which will either create a new instance of IE if one doesn't exist or use an existing instance. Cast the Document property to IHTMLDocument2 (typically, which implements most properties and methods you're probably interested in) and walk the DOM similar to how you would in DHTML scripting (although you'll have to cast objects to certain interfaces at times, since different versions of interfaces implement different properties and methods.
InternetExplorerClass ie = new InternetExplorerClass;
IHTMLDocument3 doc = ie.Document as IHTMLDocument3;
if (doc != null)
{
IHTMLElement e = doc.getElementById("table1");
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|