|
|
Hi
Please could someone help me to convert the following to Visual Basic.. or alternatively post a table driven version
It is a CRC16 algorithm using the polynomial (x16 + x15 + x2 + 1) used for very short strings.
I think (not sure) a test string of "123456789" should generate a hex checksum of: BD3B
Tks
Richard
static unsigned BitsSet (unsigned char ch)
{
unsigned n;
n = 0;
while (ch)
{
n += (ch & 1);
ch >>= 1;
}
return(n);
}
unsigned CRCof (const char *message, unsigned len)
{
unsigned i;
unsigned crc;
unsigned char k;
crc = 0;
for (i=0; i<len; i++)
{
k = (unsigned char)(message[i]) ^ crc;
crc = (crc / 256) ^ (k*128) ^(k*64);
if ((BitsSet(k) & 1) != 0)
crc ^= 0xC001;
}
return(crc);
}
|
|
|
|
|
Hi all,
I'm using ftp with the command "NLST *.*\r\n". After I send this command I get a reply:
"226 Transfer complete". I just want to get the file list, the weird thing is that
Sometimes the command works and sometimes doesnt.
The commands: USER, PASS, CWD and PASV work FINE before "NLST" command.
Any idea why?
thanx
-- modified at 6:29 Wednesday 9th November, 2005
|
|
|
|
|
I want to bind a ComboBox with a DataSet by supplying a datasource and
also want to specify ComboBox.valueMember and ComboBox.DisplayMember in a
windows form in C#. What i m trying is below the piece of code but i m
not getting the required result;
ComboBox1.DataSource = DataSet1;
ComboBox1.DisplayMember = "StudentName";
ComboBox1.ValueMember = "StudentID";
How to Bind ComboBox1 with DataSet1 ? Please correct the above code
snippt.
|
|
|
|
|
Try this snippet. I think you simply didn't bind to the Table, rather than the data set.
DataSet ds = new DataSet();
DataTable t = new DataTable("Students");
t.Columns.Add("StudentID", typeof(int));
t.Columns.Add("StudentName", typeof(string));
ds.Tables.Add(t);
for(int i = 0; i < 5; i++)
{
DataRow r = t.NewRow();
r["StudentID"] = i;
r["StudentName"] = "Test Student " + i.ToString();
t.Rows.Add(r);
}
comboBox1.DataSource = ds.Tables[0];
comboBox1.ValueMember = "StudentID";
comboBox1.DisplayMember = "StudentName"; Access the selected value:
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
MessageBox.Show(comboBox1.SelectedValue.ToString());
}
|
|
|
|
|
you need to add more qualification.
ie.
ComboBox1.DataSource = DataSet1.Table
or
ComboBox1.DataSource = DataSet1;
ComboBox1.DisplayMember = "Table.StudentName";
ComboBox1.ValueMember = "Table.StudentID";
Cheers
|
|
|
|
|
G'day folks,
I am stuck on a form design problem which I just cant seem to find any solution. I have an application (Parent Form) which requires another window (child form) to be open in a modeless mode (using Show()) and whose TopMost property is set to true. My problem becomes that if I switch applications in the taskbar, say from my application to Outlook (running in maximized mode), the child form still stays on top of Outlook. This is because the child form is set to TOPMOST being true.
One solution I had was to use the Deactivate and Activated event handlers for the parent form. In the Deactivate event handler I setup so that the child form would become invisible and in Activate Handler the child form would become visible. I didnt realise that once the parent form become active it will then make the child form visible thereby the child form become the active form thus firing the Deactivate handler for the parent form. Therefore getting stuck in an infinite loop of child form appearing and disappearing.
There has to be a solution since when the find window is open in notepad and another application is active the find window from notepad doesnt dominate.
Can anyone point out what mistake I am making, I realise this has to be a very elementary mistake.
I would really appreciate any feedback.
thanks
Vee
|
|
|
|
|
Don't use the TopMost property which is 'absolute', but the Owner property which describes a 'local order' in your application's forms set.
Tchimbaw
|
|
|
|
|
thanks for the tip. You have just saved me from having a sleepless night .
|
|
|
|
|
hi
how to add module in c#.net? There is no option in the menu project-> add module in c#.net which we have in vb.net.
sarayu
|
|
|
|
|
why do you need this, a class with static methods has equivalent functionality
|
|
|
|
|
I am trying to programatically remove cookies and temp internet files. I have found examples of how to change the Expire of cookies via Web Dev. But the Request.Cookies() doesn't work in Windows Dev.
My program is simple,
<br />
static void Main(string[] args)<br />
{<br />
LaunchWindows();<br />
}<br />
private static void LaunchWindows()<br />
{<br />
System.Diagnostics.Process.Start("IExplore.exe","http://lbprdapps:88/autosys/login"); <br />
}<br />
private static void ClearCache()<br />
{<br />
}<br />
Here is the VB equivalency in Web Dev. that I want to accomplish.
<br />
Dim i As Integer<br />
Dim cookieName As String<br />
Dim limit As Integer = Request.Cookies.Count - 1<br />
For i = 0 To limit<br />
aCookie = Request.Cookies(i)<br />
aCookie.Expires = DateTime.Now.AddDays(-1)<br />
Response.Cookies.Add(aCookie)<br />
Next<br />
Any help would be appreciated.
TIA,
Scott
|
|
|
|
|
Hi all,
i'm woking on a project which uses .Net remoting architecture.
Previously i wasn't gettin this error, but now sometimes i get his error, and i cant figure out why it comes..and how to fix it.
Please if any one knows about it, do tell what to do..
Error: Timedout expired. The timeout period elapsd prior to obtaining a connection from the pool. This may have occured because all the pooled connections weer in use and max pool size was reached..
Thanx
|
|
|
|
|
Hi all,
Can someone please tell me how can I build a C# COM Object from VC++ 6.0?
Best Regards,
E.A.
|
|
|
|
|
E6AD wrote: how can I build a C# COM Object from VC++ 6.0?
You can't. Do you mean to call one ? The same as you call any COM component, COM is language neutral.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks a lot Christian. You are right,I meant to call.
Thanks,
E.A.
|
|
|
|
|
How do I create a shorcut (in the esktop)for an existing exe file?
|
|
|
|
|
You need to pinvoke some shell stuff to do that, from memory.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi everyone,
Can someone please tell me how can I build a DLL in C#?
Best Regards,
E.A.
|
|
|
|
|
Is there not an option to make a Class Library? In VS.net Standard, the option is not there, but you can always use SharpDevelop[^]. It is a free development environment.
Pumk1nh3ad illustrates that Intelligent Design oft goes awry. - Ed Gadziemski
|
|
|
|
|
The "Class Library" project type always compiles into a .dll. Keep in mind, though, that this is a .NET assembly, not your common Win32 .dll that can be linked into an MFC app. If you need a .dll that can interop with a normal windows or MFC app, you will want to go into the projects properties, and enable exposing the project through COM.
|
|
|
|
|
Thanks Jon.
But is that the only step required to expose the project through COM?
Do you have any detailed link that can help me out with that?
Thanks again,
E.A.
|
|
|
|
|
Hi all - if I have a user control, is there a way I can write code that will only execute at runtime, not when the control is rendered in the forms designer ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Control.DesignMode does the trick !!!
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I like how you always answer your own questions, Christian. Its very entertaining, not to forget helpful to the community.
|
|
|
|