|
I get the following problem (probably because I didn't parse correctly):
Expression is a value and therefore cannot be the target of an assignment.
Is there a better way to do this:
Me.Size.Height = My.Settings.MainFormHeight ' I have a setting called MainFormHeight
|
|
|
|
|
OK, now I see your problem.
Form has Size property, and Size has a Height property,
both have getters and setters; nevertheless you can not change a Form's height by
doing Form.Size.Height=somevalue;
instead you should create a new instance of Size with the right values in the constructor,
then assign this to Form.Size
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Excellent! Works great! I can tell it to look at a variable too, right?
|
|
|
|
|
Sorry, I once more don't know what you mean by that. But probably yes.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
you should also be able to save the form size as a size value in settings as oppose to two seperate settings.
|
|
|
|
|
How do you disable rows in SQL using vb.net?
jds1207
|
|
|
|
|
Disable rows in a datbase table?? You don't. Using security in SQL Server, you can manage the access to the entire table, but not the individual rows.
|
|
|
|
|
like Dave said, there is no "built-in" method.
you can add a column to the table calling it "Enabled" or something and in your 'where' clause ask for all rows where Enabled=1
|
|
|
|
|
Well, I know you can do that sort of thing in a Janus GridEX by using conditional formatting. Maybe you can tell it to hide rows. I believe there is a trial version on the web somewhere.
It is possible you could mean columns, which is easy from a datatable in VB.NET.
If you really need to, use some special conditional formatting code and move the rows you do not want to a separate table.
|
|
|
|
|
I have a program that binds to a table that gets updated by another program. The table updates a dataset that is shown in a data grid. Each time a row is added to the table via the program, I want to grab that row and send it somewhere. How can this be done. Would I look at the table that is updated every 5 sec to see if changes (but changes could be deletes not Additions) or look at the dataset that I am filling? (Binding) Final choice would be using the data grid that I am using to display the rows.
Any Ideas? Thanks.
|
|
|
|
|
DataTable class offers 11 different events.
You do occasionally read documentation don't you ?
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/AllLanguages/General
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi,
Use Dataset. But it is not advicable. But for over requirement, every time refresh the dataset(Dataset.Reset()) every time it will fill. N allow to load the datagrid. Use DataAdapter.
The DataTable is Very Good only for showing of DataGrid with diffrent Formats. But refreshing it is very tedious process and Non-Optimazation.
|
|
|
|
|
I've been working on a small function today that is confounding me to no end. I have a file that is one line, the file size is ~400k bytes, and is a list of items delineated by a '~'.
The funny thing is, I can see the data on the stream while viewing in the debugger, but the data doesn't get assigned to the variable, no matter what it is. (note: I've tried assigning to regular strings and to the stringbuilder class as well, without the Split() of course )
The errant piece of code looks like this:
<br />
Dim al as New ArrayList<br />
<br />
m_istream = New StreamReader(m_ipath)<br />
al = al.Adapter(m_istream.ReadToEnd().Split("~"c))<br />
I've tried this with much success on smaller strings(not streams), and I don't understand why this assignment isn't working. Could someone give me a hand please?
Thanks in advance.
Jason
P.S. I'm using VS 2003
-- modified at 13:40 Monday 6th August, 2007
"In the middle of difficulty lies opportunity." Albert Einstein
|
|
|
|
|
First, what's that "Adapter"??
Second, break the line up so you can see what's going on with the debugger, step-by-step:
m_istream = New StreamReader(m_ipath)
Dim data As String = m_istream.ReadToEnd()
Dim items As String() = data.Split("~"c)
' I have no idea what "al" is and what the "Adapter" method is.
al = al.Adapter(items)
|
|
|
|
|
Thanks for the help.
<br />
Dim data As String = m_istream.ReadToEnd()<br />
'data' is null after the the call to ReadToEnd(),even though I can see data returned from this function in the debugger. This is the problem that has been plaguing me. It seems that I can't assign anything off the stream to a variable. I'm at a loss as to why.
The 'al' is an ArrayList, a very useful enumerated array type, the Adapter() method takes an IList object(string array in this case.) and converts it to an ArrayList. Just FYI.
Jason
-- modified at 14:06 Monday 6th August, 2007
for clarity, here is the exact code block:
<br />
Try<br />
m_istream = New StreamReader(m_ipath)<br />
m_al = m_al.Adapter(m_istream.ReadToEnd().Split("~"c))<br />
Return True<br />
Catch ex As Exception<br />
Return False<br />
Throw New Exception("Error Reading File! See InnerExcpetion.", ex)<br />
Finally<br />
m_istream.Close()<br />
End Try<br />
"In the middle of difficulty lies opportunity." Albert Einstein
|
|
|
|
|
Payrok wrote: The 'al' is an ArrayList
It would help if you explained what types were involved in the code. From what you posted, there's no way to tell that al was an ArrayList .
Well, you can try it like this then:
Dim data As String() = File.ReadAllText(m_ipath)
For Each s As String In data
Dim items As String() = s.Split("~"c)
al = al.Adapter(items)
Next
|
|
|
|
|
Sorry about that. I thought that I had, but I get ahead of myself sometimes. I should have realized that you knew what an arraylist was, I wasn't trying to be condesending. I'll give the File.ReadAllText a whirl.
Thanks again.
Jason
"In the middle of difficulty lies opportunity." Albert Einstein
|
|
|
|
|
Is that method for 1.1 framework? I'm not seeing it.
"In the middle of difficulty lies opportunity." Albert Einstein
|
|
|
|
|
|
it turns out that the while I was trying to watch the data in the debugger, the data was consumed, never to ne seen again, thus preventing anything I was attempting. I feel like such a dope. Anyways, thank you for the help Dave, and I apologize again for the comment.
Jason
"In the middle of difficulty lies opportunity." Albert Einstein
|
|
|
|
|
No problem. Even the pro's lose their minds once in a while!
|
|
|
|
|
I have developed a small database software in .Net 2.0 which has backend as Sql Server Express2005.Both of the server and client are running Windows XP. My client successfully detects the server but when
connecting to the server, it displays the error message "Cannot generate SSPI context".
I have also searched the internet but couldnot find any good solutions.
Could you people have any solution for this terrible error?
Help appreciated in both VB.Net and C#.
X
|
|
|
|
|
We'll have to see the code that generated this error. It would also help if you showed the connection string you're using to connect to the database.
|
|
|
|
|
Here is the code:
Server computer name is stored in My.Settings.Server property.
Public Shared Function RetCn() As SqlConnection
Dim sqlCnB As New SqlConnectionStringBuilder
sqlCnB.DataSource = My.Settings.Server & "\SQLEXPRESS"
sqlCnB.InitialCatalog = "CompA"
sqlCnB.IntegratedSecurity = True
sqlCnB.UserInstance = False
Dim sqlCn As New SqlConnection(sqlCnB.ConnectionString)
Return sqlCn
End Function
X
|
|
|
|
|
OK, this is .NET 3.0 because of the ConnectionStringBuilder class....
You cannot use Integrated Security if the two machines are not in a domain environment. If both of your machines are in workgroup mode, you MUST turn off Integrated Security and supply a username and password to get into the database.
Integrated Security uses the current users security token to login to the other machine. Since in workgroup mode, each machine maintains its own user database, the security token generated on one machine is not valid on the other.
Also, SQL Server uses two authenitcation mechanisms. Turning on Intergrated Security, or Trusted Connection, tells the connection string that the SQL Server is using Windows Integrated Security, instead of SQL Server Authentication. Using Windows Security means that the SQL Server will trust and use the machines user accounts (the machine the SQL Server is running on) for security ID's.
|
|
|
|