|
Not that simple. Data is an extract - usernames can repeat along with supervisor. The unique piece (data point) is their role which is why this is in the code
sRole = .Cells(l, 6).Value
Else
sRole = sRole & ", " & .Cells(l, 6).Value
|
|
|
|
|
I am sorry bu that means nothing to me, as I have no idea what the structure of your data is. However, the issue is the same as most problems of this type. You must run through the data as many times as necessary to build the groups which have the common item (e.g supervisor, role etc) that you are interested in. The first thing to do is write down all the common criteria, and then decide on how to build the groups using those rules.
|
|
|
|
|
Hello !
I have a vb.net program.
In my program I want to use dates in the format "dd/MM/yyyy".
But when the windows date format is different I get errors.
For example if my program is executed in a Pc where the date is in the format : mm/dd/yyyy I get errors for example when day is more than 12 :
Dim dt As DateTime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss")
I get error :
Conversion from string "20/09/2016 21:21:47" to type 'Date' is not valid.
What can I do to make my program work whatever the windows date format is configured.
|
|
|
|
|
That error does not happen where the date is formatted as a string. It happens when exactly the opposite happens: when the string is parsed to return a DateTime. At those positions, you must use DateTime.Parse("dd/MM/yyyy HH:mm:ss")
|
|
|
|
|
This is why all VB.NET programs should be compiled with Option Strict On .
You're taking a DateTime , converting to a String , and then assigning that String to a DateTime value.
Without Option Strict , VB is attempting to convert that String back to a DateTime . But it has to make some assumptions, one of which is that the String represents a date formatted using the current culture settings - in this case, US-format dates.
If you turn on Option Strict , you will get a compiler error telling you that you cannot store a String in a DateTime variable.
You could use DateTime.Parse or DateTime.TryParse to try to convert the String back into a DateTime .
But it would be much simpler to just not convert the DateTime to a String in the first place!
Dim dt As DateTime = DateTime.Now
Remember, a DateTime value does not have a "format" stored with it. It is simply the number of ticks since midnight on 1st January 0001. You only use a format when you are displaying the value to the user, or parsing a user-supplied string back into a DateTime .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hello !
I'm using visual studio 2013.
In my app.config , there are 3 connections strings :
<connectionStrings><add name="db1Entities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=PERSONALPC\MSSQL2008R2;initial catalog=db1;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="db2Entities" connectionString="metadata=res://*/Model2.csdl|res://*/Model2.ssdl|res://*/Model2.msl;provider=System.Data.SqlClient;provider connection string="data source=PERSONALPC\MSSQL2008R2;initial catalog=db2;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="db3Entities" connectionString="metadata=res://*/Model3.csdl|res://*/Model3.ssdl|res://*/Model3.msl;provider=System.Data.SqlClient;provider connection string="data source=PERSONALPC\MSSQL2008R2;initial catalog=db3;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
Now , I want to access these connections strings , using the following code :
Dim connstringtemplate1 As String = System.Configuration.ConfigurationManager.ConnectionStrings(1).ConnectionString.ToString
This string has "NULL" value
Dim connstringtemplate2 As String = System.Configuration.ConfigurationManager.ConnectionStrings(2).ConnectionString.ToString
This string has the first connection string
Dim connstringtemplate3 As String = System.Configuration.ConfigurationManager.ConnectionStrings(3).ConnectionString.ToString
This string has the second connection string
Dim connstringtemplate4 As String = System.Configuration.ConfigurationManager.ConnectionStrings(4).ConnectionString.ToString
This string has the third connection string
Also if I use this :
Dim nr As Integer = System.Configuration.ConfigurationManager.ConnectionStrings.Count
The value of nr is 5.
I have only 3 connection strings , so why there are 5 and the first is empty ?
This problem appear after I have installed the Update 5 on visual studio 2013.
Before everything was ok.
Thank you !
|
|
|
|
|
Why are you getting connectionstring by index instead of getting them by using their name?
|
|
|
|
|
desanti wrote: I have only 3 connection strings , so why there are 5 and the first is empty ? They are probably getting merged in from the machine.config file. You can use
<clear /> in .config to get rid of them. c# - ConfigurationManager.ConnectionStrings returns extra connection string from machine.config - Stack Overflow[^]
But, as pointed out in the other response, the better option is to refer to them using a name rather than depending on their order.
ConfigurationManager.ConnectionStrings[connectionName].ConnectionString
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
First off, I'm sorry if this is in the wrong section .I have this project that needed to receive data from PLC. The PLC comes from Keyence. Right now, I'm having hard time on how can I create it. Anyhelp will do. Thank you!
|
|
|
|
|
What sort of help are you looking for? Have you studied the documentation of the PLC device (whatever that is) to see whether you are accessing it correctly? Have you written any VB.NET code yet, and if so where is the problem?
|
|
|
|
|
Hmmm... where to start?
A PLC is a Programmable Logic Controller - basically an industrial computer.
So, how does the PLC make the data available - a direct connection or a networked connection?
Does the manufacturer have any code samples of how to connect to their device and get data from it?
We are generally willing to help, but your question is very wide open...
|
|
|
|
|
It's been a long time since VB6 has mystified me in its behaviour!
I have a function that solves Kakuro puzzles. It uses a 2D and a 3D array (both Integer) as its main data structures and employs a conventional DFS approach.
Naturally I compile to EXE with all run-time checks disabled for maximum grunt.
Recently I accidentally turned off these optimizations (I was in the wrong project window). But when I restored them and rebuilt the EXE I found to my horror that my solver has lost its mojo.
Every benchmark test I have reports exactly the same results (including, importantly, the number of DFS recursions) BUT all of them run 3 times slower than before. Nothing else has changed that I can think of.
I'm at a loss to explain this. Any ideas?
Mathimagics
|
|
|
|
|
You are hoping someone can give you advice on the performance of an unknown function in a dead language, compiled by an IDE that is more than a decade out of date, on an unknown OS.
I can only suggest the obvious - rebuild your function into a current language.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Ouch!
Dead language? See this article!
Unknown OS? The VB6 IDE only runs on Win32 platforms, so my OS being Windows 7 should come as no surprise.
Unknown function? Guilty!
As it happens, I had already ported the function concerned to both C and F90, and was in the middle of benchmark testing the 3 languages (using GCC 5.3 for both C and F9).
The function is a Kakuro puzzle solver, a simple DFS model, making heavy use of a 2D array (grid) and a 3D array (cell domains).
For computationally-intensive functions like this, my experience is that optimised VB6 times should be comparable to unoptimised GCC, and hitherto I was getting times consistent with this.
When compiled with -O3, however, the GCC versions run 3 times faster.
So all hail the guys at Gnu. Even without the mysterious "mojo loss syndrome", C/F90 still romps home by a factor of 3.
Mathimagics
|
|
|
|
|
Dr Memory wrote: Dead language? See this article!
Yeah, it's DEAD, for about 15 years now. Pointing at some crybabies demanding MS update it or open source it doesn't make it any more live. That just proves the point even more.
Yes, I used to use VB6 way back in the day but that changed the moment I got my hands on pre-release .NET 1.0 and had to use Notepad to write code and the command line compilers to build it. Even in that primitive environment I saw what was coming and it was a lot better than VB6. I abandoned VB6 completely the day I got my hands on Visual Studio .NET.
The VS6 IDE is barely supported on Win7 and isn't supported at all on Vista and above, so the "only runs on Win32 platforms" doesn't exactly tell anyone what they need to know. Yes, people have gotten it to work on every version of Windows XP and higher, but only buy jumping through flaming hoops to do it.
|
|
|
|
|
As Dave said the article you referenced does not indicate anything but that the demise of VB6 is permanent.
As it has been almost 15 years since I was using it I would have no idea that it could run on W7. I consider leaving VB6 for VB.net and then c# one of my better tool decisions, Silverlight still pisses me off though
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hmmm, I seem to have wandered into the wrong bar!
I will go quietly into the night ...
Mathimagics
|
|
|
|
|
It is the right bar, you're just a few years too late.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Public Class Form6
Public Property ServerName() As String
Public Property DatabaseName() As String
Public Property Login() As String
Public Property Password() As String
Private Function SqlConn(Optional ByVal timeout As Integer = 0) As String
Dim sqlBuilder As New SqlClient.SqlConnectionStringBuilder()
' Set the properties for the data source.
sqlBuilder.DataSource = "Softlinks-PC"
sqlBuilder.InitialCatalog = "RMS"
sqlBuilder.IntegratedSecurity = False
sqlBuilder.MultipleActiveResultSets = True
sqlBuilder.UserID = "Softlinks-PC\Softlinks"
sqlBuilder.Password = ""
If timeout > 0 Then
sqlBuilder.ConnectTimeout = timeout
End If
Return sqlBuilder.ToString
End Function
Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call SqlConn()
Dim sql As String
Dim ds = New DataSet
Dim tables = ds.Tables
Dim da = New SqlClient.SqlDataAdapter
Sql = "SELECT * FROM Productitem"
da.Fill(ds, "Productitem")
'Dim view As New DataView(tables(0))
Dim view As New DataView(ds.Tables(0))
DataGridView1.DataSource = view
End Sub
End Class
|
|
|
|
|
Hi all, I have e little problem that I hope someone can help me to solve it.
I have a Form in which there is a panel where I draw a graphical diagram using instruction paint, drawline.
The graphical is correctly drawn, but if I Minimize the Form and after I re-Maximize the Form, all contents of Form is maintened but the graphical in the Panel is lost.
What can/must I do to avoid this problem?
I am developing in VB of VS 2008.
Thanks
|
|
|
|
|
Repaint whenever the OnPaint event fires.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thanks, I will try (I am not expert).
Refresh is the same of Repaint?
|
|
|
|
|
No, he means put all of your painting code in a method that is called by the OnPaint event of the Panel. When Windows tells your app to repaint itself, your painting code should do everything it needs to draw everything on the Panel. You'd be surprised how often your painting code is going to be called.
|
|
|
|
|
Thanks all for help.
Regards
|
|
|
|
|
Is it actually possible for me to make an Windows Explorer but with more features just like Revolutions Pack?
Or will VB6 make this impossible?
Any tips are welcome.
|
|
|
|