|
To make sure, I ran my own tests on DoEvents in a UserControl and it does work. The problem has to be somewhere else as far as I can tell. Again, we can't see your code, so it's impossible to tell you what's going on.
|
|
|
|
|
Dang. I was afraid of that. I think i buggered it up!
I'm going to have to go through it with a fine tooth comb, and figure out what I did, then. Which may just be an exercise in understanding something I will never use again. As I research threading more, there might be a reasonably easy way of making the transition to it.
|
|
|
|
|
Can anyone please compress the following code? This code is used to make the text property of radiobuttons in a groupbox display values from columns of a dataset.
For Each rad As RadioButton In GroupBox1.Controls
If b > 1 Then
rad.Text = ds.Tables("AddressBook").Rows(a).Item(b)
b = b - 1
End If
Next
a = a + 1
For Each rad As RadioButton In GroupBox2.Controls
If c > 1 Then
rad.Text = ds.Tables("AddressBook").Rows(a).Item(c)
c = c - 1
End If
Next
a = a + 1
For Each rad As RadioButton In GroupBox2.Controls
If d > 1 Then
rad.Text = ds.Tables("AddressBook").Rows(a).Item(d)
d = d - 1
End If
Next
|
|
|
|
|
i can loop through the rows in a dataset using the code below. But how can i loop through the individual items of the same row.
For Each myControl As Control In Me.Controls
If TypeOf myControl Is GroupBox Then
For Each rad As RadioButton In myControl.Controls
rad.Text = ds.Tables("AddressBook").Rows(b).Item(c)
Next
b = b + 1
End If
Next
|
|
|
|
|
Hi,
I'm not able to get the cell value for the selected row in the gridview, the code in the aspx page:
<asp:GridView runat="server" ID="gvElMaster" PageSize="5" Width="100%" ItemType="EMS.Ems_ElMaster"
DataKeyNames="ElMasterID" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
SelectMethod="GetElMaster" HeaderStyle-VerticalAlign="Middle"
HeaderStyle-HorizontalAlign="Center" CaptionAlign="Top" CellPadding="4" GridLines="None" ForeColor="#333333"
OnSelectedIndexChanged="gvElMaster_SelectedIndexChanged">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:DynamicField DataField="ElName" />
<asp:DynamicField DataField="ElStartRegDate" />
<asp:DynamicField DataField="ElEndRegDate" />
<asp:DynamicField DataField="ElDate" />
<asp:CommandField ShowSelectButton="True" SelectText="Select" CausesValidation="False" InsertVisible="False" ShowCancelButton="False"></asp:CommandField>
</Columns>
</asp:GridView>
code behind:
Public Function GetElMaster() As IQueryable(Of Ems_ElMasterClass)
Return _db.DbSet_ElMasters
End Function
Protected Sub gvElMaster_SelectedIndexChanged(sender As Object, e As EventArgs) Handles gvElMaster.SelectedIndexChanged
MsgBox(gvElMaster.SelectedIndex)
MsgBox(gvElMaster.SelectedValue.ToString)
MsgBox(gvElMaster.SelectedRow.Cells(1).Text)
MsgBox(gvElMaster.SelectedRow.Cells(2).Text)
MsgBox(gvElMaster.SelectedRow.Cells(3).Text)
End Sub
I get empty text from all the cells
Development envirunment is:
- VS 2012
- Asp.net 4.5
- CodeFirst aproach
Thanks for the help
|
|
|
|
|
Hello Friend I am making a GUI for my vpn in visual basic and I am getting a problem when I am using
("perl something.pl" + somehting + something1 + something2)
but when I am using
("perl something.pl something1value something2value")
everything is working fine any solution please
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim IP As String = "xxx.xxx.xxx.xxx"
Dim Username As String = "root"
Dim Password As String = "mypassword"
Dim cmd As Renci.SshNet.SshCommand
Dim connInfo As New Renci.SshNet.PasswordConnectionInfo(IP, Username, Password)
Dim sshClient As New Renci.SshNet.SshClient(connInfo)
Dim something As String = TextBox1.Text
Dim something1 As String = TextBox2.Text
Dim something2 As String = TextBox3.Text
sshClient.Connect()
cmd = sshClient.RunCommand("perl something.pl" +something + something1 + something2)
Label1.Text = cmd.Result
End Sub
End Class
|
|
|
|
|
All of your textbox values are being smashed together.
If the user types param1 in TextBox1 and param2 in TextBox2, your command line will look like this:
perl something.plparam1param2
You're not putting spaces between the command line parameters.
|
|
|
|
|
I appreciate your help but how to put spaces them because if I am giving spaces between the commands they are getting back in from once again.
|
|
|
|
|
cmd = sshClient.RunCommand("perl something.pl " + something + " " + something1 + " " something2)
Use the best guess
|
|
|
|
|
Thanks my problem is fixed now
|
|
|
|
|
Hi all.
I have a question about program performance. I have a ton of loops all over the place, and a pause button to pause execution. The pause button is pretty much useless right now as it gets superceded by what I figure are long-winded loops. In an attempt to locate the problem loops, I ended up placing temporary DoEvents lines in all of them. The idea was to see if I could get better performance out of the button. Then, I could remove the majority of those DoEvents that did not impact performance all that much. Unfortunately, all that work resulted in no better performance at all for the button. So I have two questions:
1. Is there some utility that can pinpoint where the majority of a program spends its time, without placing timers or stopwatches everywhere.
2. Are their certain events or API functions that can essentially "shut-down" DoEvents lines?
Thanks for any advice!
|
|
|
|
|
DoEvent was never going to get you any performance benefit, and, frankly, we're all looking at you funny for even thinking so.
DoEvents stops your code and execute all the messages pending in your apps message pump. Nothing more...
What you're looking for is a code profiler. If you have an Ultimate Edition of Visual Studio, it's built in. If not, you'll have to use a third party product, none of which are free.
|
|
|
|
|
I'm probably not explaining myself clearly. If you have a long-winded loop somewhere and want to pause execution for some reason, you can't do it with a button click unless you have a DoEvents line in there so that the loop can stop long enough to process system events. By "performance", I meant that the "performance" of the Pause button improves because now it has a chance to be processed in the middle of the loop. I know that DoEvents() slows things down for exactly the reason you point out, but under the circumstances, unless there is an alternative to DoEvents(), I'm stuck.
But the other possible explanation of the problem is that somehow, no matter what loops I put my DoEvents lines in, something shuts them down so that they do not respond. Is that likely?
|
|
|
|
|
treddie wrote: you have a long-winded loop somewhere and want to pause execution for some
reason, you can't do it with a button click unless you have a DoEvents line in
there
Wrong. The correct technique is to move the long running operation to a background thread. Then you don't need DoEvents (and the headaches that come with it) and just set a flag or some other synchronization object. That way your UI isn't blocked.
|
|
|
|
|
Ah...OK. I need to think parallel these days.
And thanks for the info on code profilers. I did do a quick search and found a couple of free ones, though I don't know if they are any good, or for that matter, truly "free" (aka fully-functional, non-demo).
Thanks for the help. Much appreciated!
|
|
|
|
|
Just make sure you're not using a memory profiler. Those are a bit more common and some of those are free. They're not the same as a code profiler.
|
|
|
|
|
To determine where your code is spending time, consider using some sort of switchable logging. Use a boolean operator to turn logging on/off, or a variable to set the level of desire logging.
Then, if logging is enabled, mark in a log the entry and exit time of each routine, each loop, each loop iteration, etc as desired.
Is is pretty? No, but if you don't have funds available to purchase a professional product, it provides a solution.
|
|
|
|
|
Heheh...That's why I didn't want to go that route. It's a lot of work that is for temporary use. Oddly, though, I had already set up a logging system for this program to write to a text file at key points in the code, so that any customers who buy my program could send me that file if they run into any bugs. The only thing missing are the time stamps. So, come to think of it, since it's already in place, it's not such a big deal to add time stamps.
As for the two profilers I located:
This one is free, but appears tailored to AMD chips:
http://developer.amd.com/tools/heterogeneous-computing/amd-codeanalyst-performance-analyzer/
This company has a free version of their product, but didn't have time to check what it's limitations are:
http://eqatec.com/Profiler/Download.aspx?BannerId=1&VendorId=1&PortalId=0
modified 28-May-13 14:14pm.
|
|
|
|
|
hello everyone,
is there anyone could help me to this problem, I have downloaded a module file which is (exifReader), then I apply it to my system code. when I browse an image from a folder or file when I click the a button to show the properties of the image and put it to some textbox, I got this error saying " run time error 9 , Subcription out range",
this is the code for showing the properties of the image :
Private Sub Command1_Click()
If Picture1.Picture = 0 Then
MsgBox ("Insert Image First")
Else
Text6.Text = CommonDialog1.FileName
Text3.Enabled = False
Dim objexif As New ExifReader
objexif.Load (Text6.Text)
Text2.Text = objexif.Tag(GPSLongitude)
Text3.Text = objexif.Tag(GPSLatitude)
Text4.Text = objexif.Tag(GPSInfo)
Text5.Text = objexif.Tag(DateTimeOriginal)
Text2.Enabled = False
Text6.Enabled = False
Text3.Enabled = False
End If
End Sub
//*******
and this the module part of code where the error shows.
Private Function InspectJPGFile() As Boolean
Dim i As Long
If ExifTemp(0) <> &HFF And ExifTemp(1) <> &HD8 Then
InspectJPGFile = False
Else
///this line is having error, subscription out of range///
For i = 2 To UBound(ExifTemp) + 1
If ExifTemp(i) = &HFF And ExifTemp(i + 1) = &HE1 Then
Offset_to_APP1 = i
Exit For
End If
Next
If Offset_to_APP1 = 0 Then
InspectJPGFile = False
End If
Offset_to_TIFF = Offset_to_APP1 + 10
Length_of_APP1 = _
ExifTemp(Offset_to_APP1 + 2) * 256& + _
ExifTemp(Offset_to_APP1 + 3)
If Chr(ExifTemp(Offset_to_APP1 + 4)) & Chr(ExifTemp(Offset_to_APP1 + 5)) & _
Chr(ExifTemp(Offset_to_APP1 + 6)) & Chr(ExifTemp(Offset_to_APP1 + 7)) <> "Exif" Then
InspectJPGFile = False
Exit Function
End If
InspectJPGFile = True
End If
if the codes are not enough to analyze please tell me and I post all the code for exifreader class module, any idea and help are really appreciated. thanks..
by the way I use Visual basic 6.0.. ^_^
jonel
|
|
|
|
|
You shouldn't be using VB^ for any new development as the language has been dead and unsupported for years now.
But, look at your For loop and the bounds you used. You're asking it to give you the upperbound of the ExifTemp array, and then you're adding 1 to it. Uh, it just told you that the upper bound is this value and you ignored it and tried to go higher than that. You cannot index into an array higher than the upper bound it just gave you!
|
|
|
|
|
hi
i'm doing the vb project
how to record the videos and saving the videos in vb6
please send the codes
|
|
|
|
|
Firstly you don't want to be doing this in VB6 - it's an unsupported language.
Using VB.NET would be better (I'd use C# but that's just my preference).
Secondly you can't record videos in any language ... but you can interface to a camera - exactly how may depend on which camera you use.
This article does some stuff with a webcam - it's in C# but there are plenty of ways of converting into VB for free (look on Google)
Versatile WebCam C# library[^]
|
|
|
|
|
Hello guys,
I posted a question earlier and gut a reply but i dont know how to reply to them, anyway thanks Zoltan and Ron. here is my question, "i have two forms, form1 and form2. i have a button in form1 to show form 2. but when i move form1 and click the button form2 show not in the center. I want form2 always show in the center of form1 even it from another location. thanks. what i got here is this code but it gives me and error in "Me", please help
code
Dim Show_login As New form2
Show_login.StartPosition = FormStartPosition.CenterParent
Show_login.Parent = Me
Show_login.Show()
|
|
|
|
|
athan_makubex wrote: gut a reply but i dont know how to reply to them Try clicking the "Reply" link at the bottom of the message.
Use the best guess
|
|
|
|
|