|
I am not sure, but I think
this.BindingContext[this.empDataSet, "employees"].Position++;
is just a result. You must be initialize this result to navigator control related property.
Best Regards...
|
|
|
|
|
Well the navigator control buttons work.
But am trying to do the samething, but with a normal button.
|
|
|
|
|
Hi.
Ive tried googling for some time now, but havent come across anything that might lead to a solution to my "problem". I guess I aint using the right search phrase.
What I am looking for, is a way to show items on top of a fullscreen playing video. That means, I want listboxes, textfields and alike to show up on top of the video, and these items/elements can be dragged around by the user. The elements should be usable ofc.
Any ideas on what to look for? Or even better, an example?
Thanks alot 
|
|
|
|
|
AFAIK you can only do this with WPF
only two letters away from being an asset
|
|
|
|
|
Thank you, I will look into it 
|
|
|
|
|
I want to be able to pass a string into this procedure to send emails to more than one person. What am I doing wrong?
I keep getting an error that email.cc and email.to are read only fields.
I have tried to pass the parameter into the email = new MailMessage (mailFrom,MailTO)
however I only am able to pass 1 email address into it. I need to be able to pass 7 email addresses into the 1 message. How do I do this?
public static string NET_AuthenticatedMailSend(string mailFrom, string mailTo, string Subject, string MessageBody, string smtpHost, int smtpPort, string smtpNETAuthUser, string smtpNETAuthPassword)
{
MailAddressCollection MailTO = mailTo;
MailAddress MailFROM = Convert. mailFrom;
System.Net.Mail.MailMessage email = new MailMessage();
email.From = MailFROM;
email.CC = MailTO;
email.Subject = "VERSION CONTROL (AUTORESPONDER): " + Subject;
email.IsBodyHtml = true;
email.Body = "VERSION CONTROL (AUTORESPONDER): \n\r" + MessageBody;
System.Net.Mail.SmtpClient mailClient = new SmtpClient();
System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential(smtpNETAuthUser, smtpNETAuthPassword);
mailClient.Host = smtpHost;
mailClient.Port = smtpPort;
mailClient.UseDefaultCredentials = false;
mailClient.Credentials = basicAuthenticationInfo;
try
{
mailClient.Send(email);
}
catch (Exception ex)
{
MessageBox.Show("Error Sending email: " + ex.ToString());
return ex.ToString();
}
return "1";
}
|
|
|
|
|
JollyMansArt wrote: I have tried to pass the parameter into the email = new MailMessage (mailFrom,MailTO)
however I only am able to pass 1 email address into it. I need to be able to pass 7 email addresses into the 1 message. How do I do this?
CC, To is a collection of email address.
Use the Add Method of the CC and To Object to add email address(s).
If you want to add multiple addresses, call the add method multiple times with different email addresses.
Hope this helps.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
JollyMansArt wrote: I keep getting an error that email.cc and email.to are read only fields.
RTFM. They are collections, you have to add to them, not assign them.
JollyMansArt wrote: I have tried to pass the parameter into the email = new MailMessage (mailFrom,MailTO)
Again, RTFM! MailTO is a collection and there are no constructors for MailMessage taht take a collection.
only two letters away from being an asset
|
|
|
|
|
in my program i am developing login for user for standalone system
here i check the condition whether the user is valid or not ?
In my data base i store some name and passward and check whethre it present in database or not but my prog check only one user eg. Admin and passward
ie. problem in condition checking i want prog. who check other user also ie. if i type diffrent user name such as xyz and pssw. too so how i check this value in data base .
Here is my code:-
namespace loginscreen
{
public partial class Form1 : Form
{
OleDbCommand cmd = new OleDbCommand();
OleDbConnection con = new OleDbConnection();
String Path = "Provider= Microsoft.Jet.OLEDB.4.0; Data Source= C:\\sms.mdb; Persist Security Info=False";
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
con = new OleDbConnection(Path);
cmd = new OleDbCommand(" select * from login ", con);
con.Open();
OleDbDataReader reader = cmd.ExecuteReader();
string usernamedb, passwarddb;
string passwardtxtbx, usernametxtbx;
usernametxtbx = tbName.Text.ToString();
passwardtxtbx = tbPassward.Text.ToString();
while (reader.Read())
{
usernamedb = (reader.GetString(0));
passwarddb = (reader.GetString(1));
if (tbName.Text == "Admin")
{
if (tbName.Text == reader.GetString(0))
{
if (tbPassward.Text == reader.GetString(1))
{
MessageBox.Show("login successfully");
return;
}
else
{
MessageBox.Show("Try Again");
return;
}
} }
}
con.Close();
}
}
}
|
|
|
|
|
Hi,
IMO that is not the right way to do login checks; you should not read the entire table and iterate it.
this is what I would do:
1. have a table with fields username, and password
2. form the user login attempt, take the username and the password;
3. now do a "SELECT * WHERE username='"+username+"' AND password='"+password+"'"
(better yet use parameterized SQL)
4. you now either get 0 or 1 row returned, that tells you the user/password combination is unknown or known
Improvements:
- do not store passwords as text, use some encryption or hashing, and store or search the result thereof.
- better yet, apply a salt[^].
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Here is a test console application that works:
using System;
using System.Collections.ObjectModel;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using Microsoft.Office.Interop.Excel;
namespace ConsoleApplication3
{
class Program
{
static void Main()
{
Application app = new Application();
app.Visible = true;
app.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
Runspace runspace = RunspaceFactory.CreateRunspace();
runspace.Open();
runspace.SessionStateProxy.SetVariable("Application", app);
Console.WriteLine(app.Version);
Pipeline pipeline = runspace.CreatePipeline("$Application");
Collection<PSObject> results = null;
try
{
results = pipeline.Invoke();
foreach (PSObject pob in results)
{
Console.WriteLine(pob);
}
}
catch (RuntimeException re)
{
Console.WriteLine(re.GetType().Name);
Console.WriteLine(re.Message);
}
}
}
}
I first create an Excel.Application instance and pass it to the hosted PowerShell instance as a varible named $Application. This works and I can use this variable as if Excel.Application was created from within PowerShell.
I next created an Excel addin using VS 2008 and added a user control with two text boxes and a button to the addin (the user control appears as a custom task pane when Excel starts). The idea was this: when I click the button a hosted PowerShell instance is created and I can pass to it the current Excel.Application instance as a variable, just like in the first sample, so I can use this variable to automate Excel from PowerShell (one text box would be used for input and the other one for output. Here is the code:
using System;
using System.Windows.Forms;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using System.Collections.ObjectModel;
using Microsoft.Office.Interop.Excel;
namespace POSHAddin
{
public partial class POSHControl : UserControl
{
public POSHControl()
{
InitializeComponent();
}
private void btnRun_Click(object sender, EventArgs e)
{
txtOutput.Clear();
Microsoft.Office.Interop.Excel.Application app =
Globals.ThisAddIn.Application;
Runspace runspace = RunspaceFactory.CreateRunspace();
runspace.Open();
runspace.SessionStateProxy.SetVariable("Application", app);
Pipeline pipeline = runspace.CreatePipeline(
"$Application | Get-Member | Out-String");
app.ActiveCell.Value2 = "Test";
Collection<PSObject> results = null;
try
{
results = pipeline.Invoke();
foreach (PSObject pob in results)
{
txtOutput.Text += pob.ToString() + "-";
}
}
catch (RuntimeException re)
{
txtOutput.Text += re.GetType().Name;
txtOutput.Text += re.Message;
}
}
}
}
The code is similar to the first test, except that the current Excel.Application instance is available to the addin via Globals.ThisAddIn.Application (VSTO generated) and I can see that it is really a Microsoft.Office.Interop.Excel.Application instance because I can use things like app.ActiveCell.Value2 = "Test" (this actually puts the text into the active cell). But when I pass the Excel.Application instance to PowerShell, what gets there is an instance of System.__ComObject and I can't figure out how to cast it to Excel.Application. When I examine the variable from PowerShell using $Application | Get-Member this is the output I get in the second text box:
TypeName: System.__ComObject
Name MemberType Definition
---- ---------- ----------
CreateObjRef Method System.Runtime.Remoting.ObjRef CreateObj...
Equals Method System.Boolean Equals(Object obj)
GetHashCode Method System.Int32 GetHashCode()
GetLifetimeService Method System.Object GetLifetimeService()
GetType Method System.Type GetType()
InitializeLifetimeService Method System.Object InitializeLifetimeService()
ToString Method System.String ToString()
Is there a way to pass an instance of Microsoft.Office.Interop.Excel.Application from a VSTO generated Excel 2007 addin to a hosted PowerShell instance, so I can manipulate it from PowerShell?
(I have previously posted the question on StackOverflow[^], and the best answer I got was to use InvokeMember, which works, but is not what I'm after.)
Thank you in advance.
»Prosti mja u moemu nedoumeniu što ciniti! Razsuždaj: najdoh se u nuždi! Ne prolivaj slezi! Obresti li budu az i polk put k dalšoj blagozracnoj Denici? I moj dolgi život projde aki kratcje žitie. I kamo az pojdu ... gorkost smerti vižu ...«
|
|
|
|
|
Dear All,
I have parent and subreport in win form which uses Report Viewer and RDLC as Reporting Tool.
Every thing is fine as I can pass parms to both Parent and child, the only problem I face is that suppose that i am getting two records from parent with ID 1 and 2 and each of them has children with 5 records.
What i want is the Main and Subpreport should follow the following rule.
Parent Details
Id Code Discription
1 01 One // this is the first Record from Sql Statement passed
Child Details
ChildId Description //SubpReport
1 One
2 Two
. .
. .
. .
2 01 Two // this is the second Record from Sql Statement passed
Child Details
ChildId Description //SubReport
1 One
2 Two
. .
If i select single record from parent and get the child records, it shows ok
but getting more than one records from parent and the same whith child, it shows a very messy report. while i want above format
any ideas please?
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
The only thing that I could think of is that you may want to pass the IDs through a single parameter to the child report. When you build your SQL Query for the parent report, one of the columns that are returned could contain ALL the child IDs (separated by a comma). Then through a subreport parameter you could transfer this parameter that contains all the child IDs into the query for the subreport.
I think this could be accomplished a lot easier if you use the RDLReportViewer[^] control instead of having to write all that .NET code to accomplish this. With using the RDLReportViewer[^] control you can just simply create a parent and child RDL file and the RDLReportViewer[^] control could easily show the RDL reports by telling the RDLReportViewer[^] control what report to show. It will automatically run all the queries and display the user parameters[^]. Check it out...
Chris
|
|
|
|
|
I want to know how can I open an existing license.rtf (located in my application folder) in Microsoft Word and in WordPad?
|
|
|
|
|
Just start Wordpad.exe passing the filename as an argument.
|
|
|
|
|
System.Diagnostics.ProcessStartInfo wordpadPSI =
new System.Diagnostics.ProcessStartInfo(
@"WordPad.exe");
wordpadPSI.Arguments = @"C:\Users\Dave\Documents\licence.rtf";
System.Diagnostics.Process.Start(wordpadPSI); For word, use WinWord.exe, remember the end user may not have word installed.
|
|
|
|
|
Hi,
just
Process.Start(@"whateverPathYouMayHaveChosenToHideTheFile\license.rtf");
will open the file with the default app for RTF files, same as double-clicking it in Windows Explorer.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Suppose I got the following sql :
select empno, empname, deptname,sal from emp, dept where emp.did= dept.did
I need the following:
If the column name is empno replace it by eno,
If the table name is emp then replace it by employee,
If the table is dept then replace it by department,
if the column name is did replace it by deptid.
That means after operation my the sql should be as follows:
select eno, empname, deptname, sal from employee,department where employee.deptid=department.deptid
How can I do that? Can I have any sample code for that??? Please help me.
I am stuck on this place. I can't proceed without this.
|
|
|
|
|
This is not a C# question. You should have asked in the General Database forum.
What you are looking for are called aliases
SELECT empno AS eno, emp AS employee, etc.
only two letters away from being an asset
|
|
|
|
|
I have to do it using c#. Because there is no direct interaction to database here. NO I don't want to alias the column name and table name. I have the replace/ create a new sql select statement by replacing the column names and table names with the new one (According to the condition's that I described above).
Suppose I write an sql select statement in a text box. After button click I want to do the above replacement of column name and table name in the same text box...
|
|
|
|
|
so, use some of the methods in the string class; what is holding you up?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
Suppose I got emp as table but if I replace all the emp inthe sql by employee then empname is also converting to employeename which is becoming to wrong column name
|
|
|
|
|
so you must replace words, not parts of words. That requires a parser, something that chops your text (SQL or other) into words based on whitespace and/or delimiters.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
so you must replace words, not parts of words. That requires a parser, something that chops your text (SQL or other) into words based on whitespace and/or delimiters.
How can I replace the word if I can't find the words? Because see the following string:
select empno,empname,deptname,sal from emp, dept where emp.did= dept.did
see here empno,empname,deptname,sal is one word. Because there is no space here. Also there may be column alias.It will be more difficult if i use group by, order by, having clause. In that case it will be more difficult.
Ok it is easy to find different column name and table name (Using a parser). But problem is how can I just replace the old table name to new table name and old column name to new column name.
again the problem is:
Suppose I got emp as table but if I replace all the emp by employee then empname is also converting to employeename which is becoming to wrong column name
|
|
|
|
|
dokhinahaoa wrote: empno,empname,deptname,sal is one word
not in my world.
as I said: a parser, something that chops your text (SQL or other) into words based on whitespace and/or delimiters.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|