|
The .NET TextBox isn't .NETified. It's just a .NET wrapper around the standard TextBox.
Trying to do anything with it is a PITA. Alot of the stuff you can do with many controls, although the properties/methods are there, they just don't work as expected. Can't give specifics to back this up because I've blocked my last experience of this out of my brain as it was painful!
Someone (MS?) really needs to make a proper .NET TextBox, I did start myself - but it was bloody hard work and I gave up!
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi Devs,
I am trying to return a string which goes out of scope.
public static string test(Guid ID)
{
if (a == n )
{
string abc = x.group;
}
return abc
}
What would be the best way to return the abc string because as it is declared in bracket, it gets out of scope.
Thank You
|
|
|
|
|
Either by returning from inside the if statement like this:
public static string test(Guid ID)
{
if (a == n )
{
string abc = x.group;
return abc;
}
else
{
return String.Empty;
}
}
Or by creating the string and setting a default value first:
public static string test(Guid ID)
{
string abc = String.Empty;
if (a == n )
{
abc = x.group;
}
return abc;
}
Simon
|
|
|
|
|
|
Hi,
if that poses a problem, do yourself a favor: go to a bookstore, look at some tutorials on C#, buy one and study it.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
I don't agree with you here Lucy.
You learn more when you do stuff rather than reading it. So practical plus theory is a good way.
|
|
|
|
|
OK, have it your way. I won't waste any more of your time by offering readable advise, you just keep trying.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
AndyInUK wrote: You learn more when you do stuff rather than reading it.
So why use CodeProject? Do you not think you will have to read what people post in response to your questions.
Also, it is not always the case you learn stuff more by doing it. Your original post said you has trouble with using a value which was not declared in scope (scope being a word you must have learnt somewhere) - no matter how many times you right the same code, it wont suddenly start working. Therefore you have to research, usually by reading, why you have the problem and how to solve it.
In some cases you can use trial and error with a value to change a result, but as Luc hinted, it would be better to read a book on basics than to just 'do' stuff until it passes the compiler checks (which does not guarantee it will work how you want anyway)
Anyway, to make a contribution to your OP...
Based on the example you gave, I think a property would be best suited here...
public static string ABC{
get{return x.group;}
}
...this avoids the needless parameter and if statement in your function, however if you need a function like you have exemplified then I would do as follows...
public static string Test(Guid id)
{
if(a == n)
return x.group;
return string.Empty;
}
I hope you avoidance of reading has not had an impact on your ability to read my post...
Good luck for the future
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I detected some sarcasm in your response. We can no longer do that. Perhaps the following would have been better:
It may be advantageous to obtain a tutorial or other material which will facilitate your education in C#.
|
|
|
|
|
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi Joe,
I don't know where the sarcasm would be in my message; and IMO if it were there, it would still be OK as the question was already answered satisfactorily. What would be unacceptable is sneering at an OP while no effective answers are given.
And I missed three essential parts of my message in yours:
1. going to a bookstore, as opposed to ordering at Amazon or downloading something
2. looking at several books, in order to pick the one one likes most (for whatever reason)
3. studying it (to learn a lot; just owning a book isn't sufficient).
So you haven't convinced me a bit to alter my ways. I remain open for new attempts though.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Actually, I'd be happy with just calling him a dumb ass.
modified on Tuesday, July 14, 2009 1:19 PM
|
|
|
|
|
and i would be happy to call you as dick head 
|
|
|
|
|
That's Mr. Dick Head to you.
|
|
|
|
|
Luc Pattyn wrote: 1. going to a bookstore, as opposed to ordering at Amazon or downloading something
Exercise is the key to a healthy lifestyle.
Luc Pattyn wrote: 2. looking at several books, in order to pick the one one likes most (for whatever reason)
What about if your reason for buying a book is to own the first book you look at in the book store you go into? Would that come under "(for whatever reason)"
Luc Pattyn wrote: 3. studying it (to learn a lot; just owning a book isn't sufficient).
oh but there are many thing you could potentially learn by buying books without reading them. For instance, you could learn where the best place to buy books from is or how you need to buy a bigger shelf for all your new books to fit on
Of course, I'm only playing with you Luc, I'm sure I speak for many when I say you are a very valued member here at CP
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi musefan,
1. I know I should exercise more (and program less).
2. the first book I see in a book store is the book they want to sell most, not something I pay attention to. I'll make up my own mind. The "for whatever reason" really shields me from people asking "which book should I buy?" which I cannot answer since that depends on prior knowledge and experience, taste of style, need for exact information/examples/exercises, etc.
3. I probably own more books than I have read books, so there is a reason I always write "buy and study a book". It may be comforting to keep a book handy, but it is you working through it that raises your knowledge.
musefan wrote: I'm sure I speak for many when I say ...
Well thanks.
I do like a pun and a joke, that should be obvious by now, however my first concern is helping people who seriously want to be helped. When they don't take my advise, I like to think it's their loss, not mine. And I avoid the obstinate easily, my memory is serving me very well. Bye bye Andy (and several others that will remain unnamed but not forgotten).
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
<br />
public static string test(Guid ID){ return(a == n )?x.group:null;} <br />
|
|
|
|
|
now i may have to develop a win apps which grab image from mobile camera whatever cam will capture and my apps will display those pic in my desktop apps in such a way as if user will think image is broadcasting directly from mobile camera to my desktop apps.i never work before with mobile apps so it will be great help if someone tell me the logic to finished this apps.
tbhattacharjee
|
|
|
|
|
What have you tried to do so far?
|
|
|
|
|
|
|
Hi Experts,
In my VisulaStudio2008 c#.net windows Apllication i have a crystalReport(Main) it have 5 subreports.
i did this report in my local machine so i gave datasource, database name and other credentials i set as local only
but from coding i set database login details dynamically to get data from required source
my code is like this
ShiftSummaryReport report = new ShiftSummaryReport(); <br />
ReportDocument crSubreportDoc; <br />
Sections crSections; <br />
ReportObjects crReportObjects; <br />
SubreportObject crSubreportObject; <br />
<br />
report.SetDataSource(shiftSummaryDataset.Tables[0]);<br />
report.SetDatabaseLogon(user, password, server, database);<br />
crSections = report.ReportDefinition.Sections;<br />
foreach (Section crsection in crSections) <br />
{<br />
crReportObjects = crsection.ReportObjects;<br />
foreach (ReportObject crreportobject in crReportObjects) <br />
{<br />
if (crreportobject.Kind == ReportObjectKind.SubreportObject) <br />
{<br />
crSubreportObject = (SubreportObject)crreportobject; <br />
crSubreportDoc = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);<br />
crSubreportDoc.SetDatabaseLogon(user, password, server, database);<br />
}<br />
}<br />
}
i kept debug and checked, values coming to those variables and executing fine.
but still it is asking for database login.
how can i solve this?
please help me out
Thanks In Advance
--Naren
|
|
|
|
|
Hello all,
I have a little problem over here. With my word processor, I'm curerntly implementing a feature that basically automates a whole bunch of tasks that would normally require input of some sort from the user.
I'm not too sure how to explain it, and I'm not looking for code. I just need a little help getting the logic behid it right as I keep going 'round and 'round in circles and getting stuck.
A little info first: It's a tab-based word processor.
Scenario: A user clicks the "Close ALL" menu item.
Logic:
Foreach control tab in tcontrol.tabpages
if selected tab contains textbox and
the selected tab's tag property contains a filepath
and the text inside the textbox, which is inside the selected tab is not equal to the content of the file inside the selected tab's tag property
then save changes to that file. And then close that tab. Then move on to the next tab. And repeat process.
If selected tab's tag property does not contain a filepath, and the textbox inside the selected tab has a length greater than 0, then automatically display the SaveFileDialog, and then close that tab once the file has been saved.
If the selected tab's tag property contains a filepath, but the file that the filepath refers to nolonger exists, then automatically display SaveFileDialog, and close the selected tab if the document has been saved. And Repeat.
I know this might not make any sense at first, come to think of it, after reading what I just wrote, it doesn't really make a whole lot of sense to me but It's very difficult trying to explain exactly what I want to do since there are so many if's and else's etc... Is there an easier way to do something like this of would If/Else/Else If be the best way to go about it.
I've been told to use Switch Statements for this but I honestly have more trouble that way. I haven't searched on google or msdn because I have no idea what search terms to use for this.
Does anybody have any thoughts/suggestions?
thank you
|
|
|
|
|
Hi,
let me summarize that for you: you have a collection of objects (e,g, tab pages on a form), and these objects may or may not contain "dirty data" i.e. data that still needs to be saved, how to make sure it all gets saved?
This is what I do:
1. I give each object a bool dirty flag, which starts at false; gets set true whenever I change something to the object; and gets set false again when the object's content is either read from or written to permanent storage, such as a disk.
2. when I want to close the app, or close all the objects of the GUI, I enumerate the collection of objects, and for each dirty object, I ask the object to persist itself in any way fit; it is the object itself that either knows how to do that (because it holds the file path) or has to ask the user (because it does not know a file path yet).
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Ahh... That was so perfect it was almost peotic. Your answers are always spot on. Thanks you very much Luc
Jase
|
|
|
|