|
ABBASI_RA wrote: bindingsource , bindingnavigator
I never use these. So, I can't really comment further, except that I think you need to specify SQL to save, and I've not seen your code.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Migrating VB6 code to C#.....
VB6
Dim coefficients() As Double
coefficients = LeastFit(myData, order, False, 0, 0, 1)
c#
double[] coefficients;
coefficients = LeastFit(myData, order, false, 0, 0, 1);
The question is, is this OK in c#. It compiles OK but I'm assuming it will choke at run time because of the array size.
|
|
|
|
|
Why? What's wrong with the array size?
---
Year happy = new Year(2007);
|
|
|
|
|
double[] Yarray = new double[X]
The array size is missing. The array is being returned from the function.
|
|
|
|
|
Hello,
In this case the array instance is made in the method, so you dont have to care about the size of the array.
All the best,
Martin
|
|
|
|
|
Thanks Martin
I expected the compiler to cough...now I know why.
|
|
|
|
|
What you are declaring is only a reference to an array, and it's always declared without a size. The size is determined when the array object is created. For example:
double[] values;
values = new double[42];
---
Year happy = new Year(2007);
|
|
|
|
|
Guffa wrote: Year happy = new Year(2007);
I like
I have no idea what I just said. But my intentions were sincere.
Poore Design
|
|
|
|
|
You can also try to use Arraylists.
|
|
|
|
|
Is there a difference between the two?
|
|
|
|
|
getLength returns the total number of elements and getUpperBound returns the highest index number (getLength - 1) in most cases. getUpperBound can also be used on arrays of 2 or more dimensions to get the upper index of a dimension.
|
|
|
|
|
C++NewBe wrote: Is there a difference between the two?
Yes.
GetLength returns the number of items in the specified dimension.
GetUpperBound returns the index of the last item in the specified dimension.
For a one dimensional zero based array (which is the usual) that holds 10 items, GetLength(0) returns 10, while GetUpperBound(0) returns 9.
---
Year happy = new Year(2007);
|
|
|
|
|
Yes, GetUpperBound is used to get the boundaries of different dimensions of an array. Call GetUpperBound(0) to get the upper bound of the first dimension, GetUpperBound(1) for the second dimension and so on. It's in case you're using a 2-dimensional (or higher) array. Also, GetUpperBound returns the highest index of that array instead of the number of values in that array. So, whereas you would do for (int i = 0; i < arr.Length; i++) for length, you would do this for the upper bound: for (int i = 0; i <= arr.GetUpperBound(0); i++)
|
|
|
|
|
Thanks for the explanation guys....
|
|
|
|
|
Hey all,
I'm trying to create a working TypeConverter for a custom class, but it's causing me no end of problems. At the moment, everything seems to be working except for the code generation. Rather than initialising the objects in InitializeComponent, the designer is trying to do so via the Form's RESX file.
The relevant line in the InitializeComponent function looks like this;
this.graph1.Point = ((Root.Graph.GraphPoint)(resources.GetObject("graph1.Point")));
And in the RESX file, I have this;
<assembly alias="Graph" name="Graph, Version=1.0.0.39852, Culture=neutral, PublicKeyToken=null" />
<data name="graph1.Point" type="Root.Graph.GraphPoint, Graph">
<value>5, 3, 2, 1</value>
</data>
It doesn't actually compile by the way - it seems to break the RESX file. But that's not the issue. Does anyone have a clue as to why it might be serializing my object in the RESX file, and not just initializing it as normal in InitializeComponent?
Thanks.
|
|
|
|
|
hi
i want to create a player that play video files via streaming. but how to do that ? i must use directx or wmp SDK ..? can
any one help me ?
thaks
|
|
|
|
|
hey,
im also working on something similar, I need to stream video to a client from my server, how do i do that? i need a sample code.
thanks,
calabe
calabe
|
|
|
|
|
I wrote this class:
<br />
public class Send_Mail<br />
{<br />
<br />
public void send()<br />
{<br />
string to = "snaidis@gmail.com";<br />
string from = "semionn.89@mail.ru";<br />
MailMessage message = new MailMessage(from,to);<br />
message.Subject = "Using the new SMTP client.";<br />
message.Body = @"Using this new feature, you can send an e-mail message from an application very easily.";<br />
SmtpPermission permission = new SmtpPermission(true);<br />
SmtpClient client = new SmtpClient("smtp.mail.ru");<br />
client.Send(message);<br />
<br />
}<br />
}<br />
When I run it I have the following problem:
<br />
An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll<br />
<br />
Additional information: Bad sequence of commands. The server response was: Administrative prohibition -- authorization required. Users in your domain are not allowed to send email without authorization. See http:
How do I authorize the account?
SnaidiS(Semion)
|
|
|
|
|
Semion_N wrote: How do I authorize the account?
They hide that information in the documentation[^]
led mike
|
|
|
|
|
I don't really understand how to use that
I write
client.Credentials =
and then what?
for example if my user name is: abcd
and password: efg
?
SnaidiS(Semion)
|
|
|
|
|
|
string to = "snaidis@gmail.com";<br />
string from = "semionn.89@mail.ru";<br />
CredentialCache cache = new CredentialCache();<br />
cache.Add(new Uri("http://mail.ru"), "basic", new NetworkCredential("MyAcc", "MyPass"));<br />
MailMessage message = new MailMessage(from,to);<br />
message.Subject = "Using the new SMTP client.";<br />
message.Body = @"Using this new feature, you can send an e-mail message from an application very easily.";<br />
SmtpPermission permission = new SmtpPermission(true);<br />
SmtpClient client = new SmtpClient("smtp.mail.ru");<br />
client.Credentials = cache;<br />
client.Send(message);
I'v hilighted the changes, but the problem is still the same...
SnaidiS(Semion)
|
|
|
|
|
The following worked for my ISP. mail.bellsouth.net and 25 are the SMTP server name and outgoing port number respectively.
private void btnTestEmail_Click(object sender, EventArgs e)
{
try
{
using (MailMessage message = new MailMessage(myEmail, myEmail, "subject1", "body1"))
{
SmtpClient mailClient = new SmtpClient("mail.bellsouth.net");
mailClient.UseDefaultCredentials = false;
CredentialCache myCache = new CredentialCache();
myCache.Add("mail.bellsouth.net", 25, "Basic", new NetworkCredential(myUserName, myPassword));
mailClient.Credentials = myCache;
mailClient.Send(message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Good Luck.
|
|
|
|
|
Do you know any SMTP servers which doesn't require authorization?
SnaidiS(Semion)
|
|
|
|
|
They've been all but gone from the net for years spammers would find and abuse them and the owner would have to implement authorization to get off blacklists.
--
Rules of thumb should not be taken for the whole hand.
|
|
|
|