This hardly seems the right place to discuss a political issue.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
This hardly seems the right place to discuss a political issue.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
I believe this is because the RowCount
property is related to the rows visually represented by the DataGridView
control. According to your steps, after the constructor has run you have a DataGridView
control and a DataSource
attached to it that is filled with data, but the DataGridView
control hasn't done it's visual rendering yet. If you check the property after the DataGridView
has been rendered and displayed at least one time, you should get the expected value. Try placing an event handler on the Form.Shown
event and then put a break point in the handler and check the RowCount
property.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
erdinc27, You'll need to get the code letters for the Turkish culture, I'm not sure what they are but you should be able to find them rather quickly by searching the 'Net. Once you have those code letters you'll replace the "en-US" code with the Turkish code, then it will operate on the string using the Turkish alphabet.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
Please edit your post and surround the code in the '
' tags, this will format it so it will appear to others just as you normally see it in Visual Studio. You can put the tags around the text yourself or highlight the text and then click the 'code block' option above the edit window. Also, what control are you using for displaying the images?
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
You should use the method supplied by the .NET Framework called TextInfo.ToTitleCase()
; it's in the System.Globalization
namespace, the easiest way to acquire the TextInfo
object is to retrieve it from the CurrentCulture
like so:
System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase("mert efe");
MSDN Reference: http://msdn.microsoft.com/en-us/library/system.globalization.textinfo.totitlecase.aspx[^]
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
Could it possibly have anything to do with using GETDATE()
to construct 'random' portions of the string? Each pass through the loop will render the same values until the server system clock flips to the next day. It seems to me you will always get the exact same value for each pass of the loop until the next day arrives. I also don't understand your use of the RIGHT()
function, perhaps it is some odd way of padding with 0's. In each case it seems you concatenate 000's + some value and then pull the 'some value' you just concatenated from the 000's; why not just use the values themselves and not clutter it up by concatenating the 000's and values together only to turn around and take the values off? If you need to pad try using the REPLICATE()
function, as it will be easier to read:
DECLARE @hold varchar(50)
SET @hold = convert(varchar(7), SCOPE_IDENTITY()) -- or @recid
SET @hold = REPLICATE('0', 7 - LEN(@hold)) + @hold -- pad to desired length of 7
-- REPLICATE('0', 0) does not produce an error
Also if you truly need to get a random value try using the NEWID()
function which will return a random GUID
.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
When you use
string key = text.Substring((indexofTO + 2));
the Substring
method returns all the remaining text in the string starting from the supplied index. If you feel that the index position is correct try supplying a length parameter or verify there is no funky data at the end of the string. I've seen cases where odd characters have been thrown onto the end and caused me all kind of headaches especially when they are non-visual characters that most text editors won't render (like a Vertical Tab, ascii 11?). I recommend stopping at the above line in the debugger and checking all characters from indexofTO + 2 thru text.Length - 1 in the Watch window; check each individual character position and see if it contains the expected data.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
That's from my signature, it's not related to your inquiry. However, there is a saying in the United States (and perhaps other English-speaking countries) of "putting the cart ahead of the horse" in other words, doing things in the wrong order. I just reversed them to where they are back in the correct order because I'm a goofball. :laugh:
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
The easiest thing would be to call the TreeView.Invalidate()
to have it redraw itself.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
I was thinking the same thing! Also, it looks like the methods that do the work are almost identical (at least the two that were posted), so I'd abstract that logic out into its own method and pass in just the data that changes between rows.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
Yes, in some form or fashion you need to have properties that tell you whether a particular user has a particular right. In this case you are relating a set of rights directly to a user. It is common, and may be beneficial, to use 'roles' where you construct a set of roles and each role has a set of rights associated with it, then a user is assigned a role rather than a set of individual priviledges. For example, a role named 'Admin' which has all the rights and one named 'ReadOnly' that only has the BROWSE rights. Choose whichever method works best for your needs. As far as retrieving the rights, the best OOP way would be to have a User class and some kind of security class that would contain information about the user's rights. The User class would be a composite in that it would contain a copy of the security class. It would seem pretty straight-forward to have the User class create and fill the security object when the User class is filled with the User data (perhaps invoking a query or stored procedure to retrieve the rights data where UserID=X). There are a myriad of ways of accomplishing this, I just gave one example to illustrate one way it could be done.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
For C#'s COM Interop HRESULT
will be returned as uint
when using the PreserveSig(true) attribute. Change the method signatures in your interface of the two methods that return HRESULT
to return uint
instead and you should be good to go. You can also go a step further and create a uint enum
that defines the possible result values:
public enum Next_HRESULTs : uint
{
S_OK 0x...,
...
}
public enum Skip_HRESULTs : uint
{
S_OK 0x...,
...
}
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
In ASP.NET the tilde at the beginning of a path represents the local file system path to the root of the application. Without it you'd have no way for the server to reliably access the local file system relevant to the application. So, for example if I have an ASP.NET application on my local machine named "TestApp", when I call Server.MapPath("~");
I would get something like "C:\Inetpub\wwwroot\TestApp".
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
Along the lines of the other recommendations, taking the image data and constructing a Bitmap
of it seems to be extraneous. If you have the image data already, then there is no benefit in using that data to construct a Bitmap
other than being able to invoke Bitmap.Save()
. All you really need to do is write the data directly to disk:
using (FileStream fs = new FileStream(Server.MapPath(@"~\UserPhoto.bmp"), FileMode.CreateNew))
{
fs.Write(Data, 0, Data.Length);
}
This also has the benefit of removing GDI from the equation. So, if you still get an exception you will atleast be able to catch it as some sort of IO Exception and get more meaningful information about the problem.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
Did you manipulate the BackgroundWorker
through the designer in VS2010? If so, it may have added some funky code to the .designer.cs file. Just a thought...
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
Yes, what was I thinking!! :-O See, I was just checking to make sure the rest of you are on your toes!
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
I believe the System.Threading.Timer
class should be able to handle this in relatively little code. This version of the Timer
class takes a TimerCallback
delegate that it will invoke after the specified amount of time has transpired. You can also configure it via one of the constructor overloads to continue running at a certain interval, or you can have it run only a single time. Last, it takes a state object
so you can pass in some data pertaining to the operation you wish to check and that object
will be passed in to your delegate. Here's some example code just to illustrate how easy it is to use.
using System.Threading;
...
private Timer _operationTimeout = null;
private void CheckOperation(MyOperationData data, int timeout)
{
// run this timer a single time...
_operationTimeout = new Timer(new TimerCallback(CheckValue), data, timeout, Timeout.Infinite);
}
// this method will be called by the timeout timer, once the interval has elapsed
private void CheckValue(object data)
{
MyOperationData opData = (MyOperationData)data;
// check the result, if it is not the expected value throw the timeout exception
if (!opData.Value.Equals(opData.ExpectedValue))
throw opData.TimeoutException;
}
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
I've only seen this kind of thing when the debug data gets "out of sync" with the source code, and it is usually resolved by doing a re-build. However, if the project is in Release Configuration rather than Debug Configuration, then optimizations in the build could be causing it to skip the code. The thing is, it usually only skips code that it determines will never be executed. I would ensure that you are working in Debug Configuration and check the values that the if statement tests as soon as it enters the event handler. If you think the compiler is errantly determining that statement to be unnecessary and optimizing it out; stick "true &&
" at the front of it to force the statement to resolve to true and then re-build and re-run the code.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
I go with SSRS, it has all the functionality built-in that we need for all the projects I've worked on. It's also nice to have a separate Report project and be able to develop the Reports in VS2005.
Hold on a second here... Don't you think you might be putting the horse ahead of the cart?
Yes, Microsoft purposely made the String
type act like a value type, even though it is really a reference type; it is immutable. Any operations on a String
produce a copy, or a partial copy, of the String; the underlying string data cannot be directly changed. This is why you have to do a = a.ToUpper();
in the first place, rather than the ToUpper()
method directly changing the String
. This is also the reason that the StringBuilder
class exists, because it allows string manipulation without the extra copying, and thus has better performance in situations where lots of string manipulation will be happening.