|
dazinith wrote:
without being 'unsafe'
unsafe only if used incorrectly. What u have works, thus is cant be unsafe in a danger sense.
dazinith wrote:
how to parse other types such as strings, dates, and booleans?
Have a look at the Encoder classes as well as the Convert class.
A good knowledge of how types are allocated in VB would also help in your case.
<a TITLE="See my user info" href=http:
|
|
|
|
|
way - 1 : it may be unsafe. but unsafe doesn't mean that it is really unsafe . it means that "be carefulu on using unsafe, if you incorrectly use it you may crash the system LOL ). bu if you want your code pure Managed then you are wright.
way - 2 : When you wrote an int value to a file or a memory it is written as fallows,
first low part of the value and then the high part.
2 bytes value (byte0-byte1) byte1 and then byte2
4 bytes value (byte0-byte1-byte2-byte3) byte3 and then byte2 and then byte1 and latest byte0
So you must know the layout of the value of the byte array you try to read from a file. so lıater you can write the function below to read different types of value from a byte array
public static bool GetBool( byte [] MyData , int index )
{
return ( MyData[ index ] == 0 ? false : true );
}
public static short GetShort( byte [] MyData , int index )
{
short s = 0;
s = (short) ( ( ( int ) MyData[ index + 1 ] ) << 8 );
s += (short ) Mydata[ index ];
return s;
}
public static int GetInt( byte [] MyData , int index )
{
int s = 0;
s = ( ( int ) MyData[ index + 3 ] ) << 24;
s = ( ( int ) MyData[ index + 2 ] ) << 16;
s = ( ( int ) MyData[ index + 1 ] ) << 8;
s += ( int ) Mydata[ index ];
return s;
}
public static string GetString( byte [] MyData , int index , int len )
{
string s;
s = Encoding.ASCII.GetString( MyData , index , len );
return s;
}
Before converting date values from a byte array, you must know what format it has. Because i don't know the format, so i cann't help you
cheers,
Doing something is better than doing nothing. So ... Move !
|
|
|
|
|
Trying doing something like:
FileStream aFile = new FileStream(m_strReportFilename, FileMode.Open);
BinaryReader br = new BinaryReader(aFile);
Int16 nInt = br.ReadInt16();
This reads in 2 bytes from the FileStream and then converts them to a 16-bit integer (short in c# and c++). I used Int16 just to show the actual size of the return integer. Look at all the members of BinaryReader for more information.
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
Hi,
I need to have a combo box with a lot of elements ( like 200, or maybe 400 elements), what I wnat to do is that the user type the name and it goes showing the most similar matches ( something like VStudio net makes, but no need for strange control just in a combo it's ok).
Is there someway to do that ? or Should I implement a new control ?, Greetings
Braulio
|
|
|
|
|
the combobox when set to a droplist (cannot type in it) will automatically go to an item which begins with the character the user presses.. example: you press 'h', and it moves to the first item begining with 'h', hit 'h' again and it goes to the next one, etc..
as for the functionality you are looking for i have not seen anything like that.. your best bet would be adding a message handler for when a key is pressed in the combobox, and doing a BeginsWith() search with what they have typed in, if you find something then set the combobox selection to that item.. the problem is keeping the submenu expanded while they are typing.. i have no clue on the actual implementation, but im pretty sure its not built in..
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
Hi,
I've found some interesting code snippet for that autocomplete, but I think it doesn't show the list meanwhile you are typing
I found this code somewhere.
[code]
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Me.ComboBox1.Text = ""
Me.ComboBox1.Items.Add("a")
Me.ComboBox1.Items.Add("aaa")
Me.ComboBox1.Items.Add("combo")
Me.ComboBox1.Items.Add("combobox")
Me.ComboBox1.Items.Add("combobox test")
Me.ComboBox1.Items.Add("common")
Me.ComboBox1.Items.Add("common dialog")
End Sub
Private Sub ComboBox1_KeyUp(ByVal sender As Object,
ByVal e As System.Windows.Forms.KeyEventArgs) Handles
ComboBox1.KeyUp
Dim index As Integer
Dim actual As String
Dim found As String
' Do nothing for some keys such as navigation keys.
If ((e.KeyCode = Keys.Back) Or _
(e.KeyCode = Keys.Left) Or _
(e.KeyCode = Keys.Right) Or _
(e.KeyCode = Keys.Up) Or _
(e.KeyCode = Keys.Delete) Or _
(e.KeyCode = Keys.Down) Or _
(e.KeyCode = Keys.PageUp) Or _
(e.KeyCode = Keys.PageDown) Or _
(e.KeyCode = Keys.Home) Or _
(e.KeyCode = Keys.End)) Then
Return
End If
' Store the actual text that has been typed.
actual = Me.ComboBox1.Text
' Find the first match for the typed value.s
index = Me.ComboBox1.FindString(actual)
' Get the text of the first match.
If (index > -1) Then
found = Me.ComboBox1.Items(index).ToString()
' Select this item from the list.
Me.ComboBox1.SelectedIndex = index
' Select the portion of the text that was
automatically
' added so that additional typing will replace
it.
Me.ComboBox1.SelectionStart = actual.Length
Me.ComboBox1.SelectionLength = found.Length
End If
End Sub
[/code]
|
|
|
|
|
There is something with Internet explorer 5.5, there is a DLL, that has that kind of control ( that cool combos stuff comboboxEx), now I have to study, how to use it in C#...
|
|
|
|
|
|
if you add a new class entity and then assign an object to it in the constructor.
public class MyClass
{
private SolidBrush sb;
public MyClass(Color brushcolor)
{
this.sb = new SolidBrush(brushcolor);
}
This will set the brush colours during instantiation.
"I have a strange ginger man living on my roof!"
"...does PHP need templates? I don't think so because PHP's data is loosely typed. It couldn't care less if the data was about strings or potato fritters." -John Lim
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
AFAIK it is the only way you can create a brush object at instantiation that can be accessible to OnPaint.
"I have a strange ginger man living on my roof!"
"...does PHP need templates? I don't think so because PHP's data is loosely typed. It couldn't care less if the data was about strings or potato fritters." -John Lim
Jonathan 'nonny' Newman
Homepage [www.nonny.com] [^]
|
|
|
|
|
As I'm about to do in my project, I think it's better to make pens and brushes member variables -- or in my case, static variables because the same brush can be used across all instantiations -- so you don't have to constantly construct and dispose brushes in the OnPaint method.
|
|
|
|
|
You can, but make sure you call dispose on them at the end of the method, else it with quick swallow all your RAM.
<a TITLE="See my user info" href=http:
|
|
|
|
|
Hi leppie,
I have a question about that that I simply can't find a simple answer to in the MSDN documentation.
If I create a pen, brush, etc., in the OnPaint event, do I need to manually displose of it before exiting the OnPaint event?
Thanks!
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator. Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus Every line of code is a liability - Taka Muraoka Microsoft deliberately adds arbitrary layers of complexity to make it difficult to deliver Windows features on non-Windows platforms--Microsoft's "Halloween files"
|
|
|
|
|
Marc Clifton wrote:
If I create a pen, brush, etc., in the OnPaint event, do I need to manually displose of it before exiting the OnPaint event?
Preferably! The GC will dispose them eventually. Have a look in task manager to see if extra handles are continuously created.
<a TITLE="See my user info" href=http:
|
|
|
|
|
Nice to meet you !
I have simple question ...
I have experience for develop SNMP Manager in UNIX system using by C,tcl...
in that case, using UCD-SNMP ...
Now I do want develop SNMP Manager in WindowsXP using by C#.
(Microsoft Visual Studio .NET)
in this case , what can i do ?
is it support snmplib or any kinds of extension in C# ?
==============================
Name : B.S. Yoon
mail to : bsyoon@mercurykr.com
==============================
|
|
|
|
|
hi,
i have already written a class using the wsnmp32.dll api. if you want to have it , please e-mail me..
Doing something is better than doing nothing. So ... Move !
|
|
|
|
|
Thanks your kindly answer !!
If it is possible , Can you send to me wsnmp32.dll api and
can you let me know more than detail for using wsnmp32.dll !
This is first time for develop windows programing...
i hope your kindly support !!
my email address : bsyoon@mercurykr.com
==============================
Name : B.S. Yoon
mail to : bsyoon@mercurykr.com
==============================
|
|
|
|
|
check your e-mail box , please
Doing something is better than doing nothing. So ... Move !
|
|
|
|
|
Thanks your kindly answer !!
also, I get your snmp project file..
when i degug your project file, your source is needed DB (mdb)
"D:\MyPrograms\VbNet\C\OidTables\OidTable.mdb;"
38 line in "ClsOidTable.cs"
but i don't have and Don't know that Configuration for "OidTable.mdb"
can i receive OidTable.mdb file?
==============================
Name : B.S. Yoon
mail to : bsyoon@mercurykr.com
==============================
|
|
|
|
|
Sure...
Check your e-mail box , please. i've already sent it
Doing something is better than doing nothing. So ... Move !
|
|
|
|
|
Is there some handy package or library that someone can recommend for handling automatic or semi-automatic updates. Essentially, it would periodically check to see if there's an updated version of a package or library and then install it. Ideally it would be seamless to the user and would allow updating only the changed files and not require downloading an installer everytime.
Any suggestions? ZeroG.com has something called PowerUpdate which is similar, but I'd rather have something that is free and in my own control.
Thanks,
Arun
|
|
|
|
|
There is a component on GetDotNet that does just that.
NET Application Updater
Bo Hunter
|
|
|
|
|
It looks interesting... and there's source available, which is nice. Thanks!
I welcome any other suggestions...
|
|
|
|
|
I have written the user control similar to Outlook bar, written in C#. I want to browse items( Images and strings as in Outlook bar) in the same at design time and want those to persist run time. Right now I have provided collection editor class for this. Due to collection editor class I am able to add items at design time, I am able to see those items in my control which is placed on the client form, but the added items are not seen on the control when I run my application. Also "AddRange" statement for user control is not added in the "InitializeComponent" function of my client form. I have also tried a typeconverter for my user control but no effect. Please help.
|
|
|
|
|