|
daviiie wrote: But the problem is that i cant seem to put the integer decleration anywhere that doesn't refresh the value.
Is this asp.net ? If not, I don't see why a member variable wouldn't work. If it is, you need to store it in viewstate or sessionstate.
The other option if you have only one is to make it static, but I'm not sure it would help here.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
make the variable static not initialise it 0 .
Use the Following Code
Private Sub Command1_Click()
Static i As Integer
i = i + 1
Label1.Caption = i
End Sub
manoj
|
|
|
|
|
VB.net 2005
when I set the server to non blocking I get the following error
"A non-blocking socket operation could not be completed immediately"
example
Dim serverSocket As New Socket( _
localEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
serverSocket.Blocking = False
Try
serverSocket.Bind(localEndPoint)
serverSocket.Listen(Integer.MaxValue)
Console.WriteLine("Server started.")
While True
Try
Dim clientSocket As Socket = serverSocket.Accept()
As soon as I dim the Client socket I get the error.
If I set the "serverSocket.Blocking = True" then every thing works fine.
Any help would be appreciated.
mpage
|
|
|
|
|
Hi, I'm currently making a program where I have a set of lines that "glow". In other words I have a timer that decreases or increases the gradient of the colour at every interval. I've found this to work quite successfully with one line, but when I use multiple lines, they start to flicker randomly like they're refreshing or something. I know VB6 doesn't have the best graphics capabilities, but if anyone has a solution to stop this flickering or infact another explanation, it would be much appreciated. Thanks, Hoopla!
|
|
|
|
|
AS you say, VB6 is not the way to do this. Why use VB6 in 2005 anyhow ?
As VB6 has no double buffering built in, you need to do your own. Draw your lines onto a bitmap, and copy that bitmap to the screen in your OnPaint. This means you need one bitmap to show, and another that you're drawing on.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Cos I'm too pov to upgrade , but thanx for the suggestion anyway.
|
|
|
|
|
|
You need to implement "double buffering".
I'm sure there's some VB6 code examples of double buffering somewhere on the Internet.
|
|
|
|
|
I just remembered a nice easy trick to get double buffering for free in VB6. I've never tried it with an animation before, so it might require some tweaking, but it's worth a shot.
Instead of drawing these lines on a form, draw them inside a PictureBox control. Let's call this control "picLines". Make sure to set Picturebox.AutoRedraw to FALSE in the designer. When you're ready to draw a line in your code, do this...
Private Sub DrawLines()
' Double buffer this draw.
picLines.AutoRedraw = True
' Clear picture box.
' (This part might not be necessary. Try playing around with this.)
picLines.Picture = Nothing
picLines.Cls
' Draw your lines here.
picLines.Line (0, 0) -Step(picLines.ScaleWidth, 0)
' End double buffering and draw it.
picLines.AutoRedraw = False
picLines.Picture = picLines.Image
End Sub
|
|
|
|
|
Thanx for your prompt reply Josh, I'll look into it.
|
|
|
|
|
Hi,
I have a ASP form which has a radio control for "yes/no", and in the SQL server I have a data type bit to store the value, but before inserting the values, how to I convert the value "yes and no" to bit data type.
Thanks,
abhi
abhi
|
|
|
|
|
Converting a yes/no to a bit....
Enum MyBool
YES = 0
NO = 1
End Enum
dim bValue as byte
bValue = Convert.ToByte(MyBool.YES)
Or you could use this method I put together for converting strings
Public Sub ConvertStringByte(ByVal stringVal As String)
' Convert the string to a char array
Dim chArray() As Char
chArray = stringVal.ToCharArray(0, stringVal.Length)
'Convert each char into a byte
Dim i As Short
Dim b As Byte
Dim byArray(stringVal.Length) As Byte
For i = 0 To chArray.Length - 1
b = System.Convert.ToByte(chArray(i))
byArray(i) = b
Next
'Write each value out and the entire bytes
For i = 0 To byArray.Length - 1
Console.Write(byArray(i).ToString() & ":")
Next
'Reconstruct the string value and print it
For i = 0 To byArray.Length - 1
Console.Write(Convert.ToChar(byArray(i)))
Next
End Sub
|
|
|
|
|
Hi everyone, I was wondering if anyone out there knows of an efficient method of populating a custom listview control. This listview will have about 60,000 rows with about 15 columns of data and inherits from the system listview control. The problem I am having is that my customer control class stores the table of data into a class variable datatable. This takes approx 2 secs, which isn't too bad. I then populate the listview from this table, which takes 45 seconds, which is way too long. Any help would be greatly appreciated. Thank you very much. Have a nice day.
My code to populate the listview is:
Dim i As Short
Dim str As String
Dim lvRange(pData.Rows.Count - 1) As ListViewItem
Me.BeginUpdate()
For i = 0 To pData.Rows.Count - 1
itmListItem = New ListViewItem
itmListItem.Text = Convert.ToString(pData.Rows(i).Item(myArrayList(0)))
For shtCntr = 1 To myArrayList.Count - 1
itmListItem.SubItems.Add(Convert.ToString(pData.Rows(i).Item(myArrayList(shtCntr))))
Next
lvRange(i) = itmListItem
'Me.Items.Add(itmListItem)
Next
Me.Items.AddRange(lvRange)
Me.EndUpdate()
eatwork
|
|
|
|
|
DON'T put 60.000 rows of anything in any sort of control
You mention that your control is a custom control. I advise that you find some way of paging the data. I recall that there are some good articles here on CP on paging that you could moderately easy tweak to suit your control.
"God doesn't play dice" - Albert Einstein
"God not only plays dice, He sometimes throws the dices where they cannot be seen" - Niels Bohr
|
|
|
|
|
Hi Mr.Larson,
Thank you for your response. I have begun recoding my form to only populate the listbox after an event has fired to limit the # of rows that will be populated. Thank you for your help.
eatwork
|
|
|
|
|
Hmmm... that's a tough one. It looks like your doing all the right things. You have your BeginUpdate() and EndUpdate().
Also, AddRange() is the fastest way to add items to your ListView. I measured this several months back, and AddRange() was about 20 times faster than individual calls to Add().
The ListView is really just a wrapper over Window's list control. Perhaps the thing to do is to make direct win32 calls via P/Invoke, which would avoid the overhead. However, the marshalling involved with doing P/Invokes adds overhead too. So that might not be fast enough either. (I don't think you can make unmarshalled/unmanaged calls to win32 libraries in unmanaged blocks in C#, but don't quote me on that.)
Of course, the easiest solution would be to add a progress control here. That is if you can get away with it.
|
|
|
|
|
Hi Mr.Quick,
THank you for your response. The reason I asked this was that I can add the records to a combobox via its datasource way faster and was curious if there was a method to add a datasource to a listbox in the same way to improve the performance. Thanks for your help.
eatwork
|
|
|
|
|
I'm a newby to mobile development and was needing a hand figuring out how to load images into a pictureBox control at runtime, I had originally solved the problem using an imageList but decided the constraint of having a uniform size for each image in the list was not even close to ideal.
Thanks a bundle in advance for your help.
BMW
|
|
|
|
|
i am trying to fetch the data for the crystal report at the runtime by
adding a crystal report viewer and ten givin
OleDbDataAdapter1.Fill(DataSet11)
DataGrid1.DataSource = DataSet11
Dim cr As New CrystalReport1()
cr.SetDataSource(DataSet11)
CrystalReportViewer1.ReportSource = cr
also i have created manuual connections , but no data is getting fetched in the report where as it is working fine vth a datagrid. What is the problem? also please help me in using parameterized qurries for crystal reports???/
|
|
|
|
|
i have created a datagrid on a windows form using vb.net. It is showing the data after retrival from a table. but now i have added a button --update changes and now i want that when the user changes anything in the datagrid it should get updated in the database. how can we do this?
|
|
|
|
|
Would like some code to find an image or a picture from a folder in the computer and place it on a form or an unbound object frame in Ms Access Application.
Thanks in advance.
Regards
Joseph
Joseph K. Mckenzie
|
|
|
|
|
I have a web form with 2 datagrids.
DataGrid1 has a few columns, the first of which is a button that, when clicked, causes DataGrid2 to be filled accordingly. The logic works fine.
Upon entry into the form, and immediately after filling DataGrid1, which will always have at least one row, I would like to "auto-click" the button in the first row.
How can I do this?
Bill
|
|
|
|
|
u mean when the from is loaded datagrid2 must b filled with the data that corresponds to the value of the first row of the datagrid1 right?
i am not sure but i think you can retrive the desired cell of the datagrid using the code:
datagrid1.item(rownumber,columnnumber)
using this write the query to fill the second grid at the form load event itself.
this is what i can think of. pls let me know if this works.
|
|
|
|
|
Your summary of what I was trying to do is correct.
This is what I found that works:
Dim button As Button = DataGrid1.SelectedItem.Cells(0).Controls(0)
varWhatever = button.Text
If I get the chance I will try your suggestion and get back to you
|
|
|
|
|
I have populated my datagrid and made some changed in our data now I want to save it to my database, don't have any idea how to? I am using dataset.
|
|
|
|