[VB 2008] Can't Use { } As A Normal Text In String.Format()
Mar 12, 2010Is there any possibility to make this true?I mean we can't use { } as a normal text in String.Format()
View 4 RepliesIs there any possibility to make this true?I mean we can't use { } as a normal text in String.Format()
View 4 Repliesin my application, I am pulling in items from a microsoft project file using mpxj - one of the items I need is the predecessors. The way I am able to pull the predecessor is using a build in function of mpxj which returns a type of java.util.list - I can save this to variable as an object, but I need to find a way to bring the data to a format I can easily use so I can store it into a database. Listed below is the line of code I am using to pull the predecessors from the project file.
Dim predecessors = task.getPredecessors
and here is the result when putting a tracepoint in to get the value of predecessors
[[Relation [Task id=4 uniqueID=45577 name=Standards Training - Round 2] -> [Task id=3 uniqueID=45576 name=Process Excellence Training]]]
Even if I could get the above as a string, I could work with it enough to get the data I need. The above example is where there is 1 item in the predecessor list, but sometimes there are multiple items. Here is an example of the tracepoint when there are multiple items.
[[Relation [Task id=63 uniqueID=45873 name=Complete IP Binder] -> [Task id=47 uniqueID=45857 name=Organizational Assessment]], [Relation [Task id=63 uniqueID=45873 name=Complete IP Binder] -> [Task id=49 uniqueID=45859 name=Document Deliverables]], [Relation [Task id=63 uniqueID=45873 name=Complete IP Binder] -> [Task id=56 uniqueID=45866 name=Infrastructure Deliverables]], [Relation [Task id=63 uniqueID=45873 name=Complete IP Binder] -> [Task id=58 uniqueID=45868 name=IT Deliverables]], [Relation [Task id=63 uniqueID=45873 name=Complete IP Binder] -> [Task id=60 uniqueID=45870 name=Organizational Deliverables]]]
I am trying to bind a textbox to a binding source (using the IDE DataBindings Editor) and it works fine except for one thing: if I delete the text I get the subject error. What I want to happen is the datarecord field be updated to a dbnull value -- how do I get that to happen?
View 4 RepliesIs there any way to convert null terminated string to normal string.I mean I can easily make a program to find the location of vbnull but there has to be a built in function for that.
View 1 RepliesI'm developing a TextBox Component that is suited for handling passwords. I was using A string Builder to hold the password But now I discovered the Secure String! It is Perfect for what I want to do except one Problem! How do you get it back to a normal string! I've heard you can convert it to a BSTR and then use windows API to read the memory location and convert that to a string.
View 2 RepliesI seem to be having a problem with the Format() Function. I am trying to format a string of text from a variable so that it uses commas as thousand separators, but I can't seem to get it working properly. Here's what I'm using:
Dim testVar As String
testVar = "10000"
testVar = Format$(testVar,
When I use this code, it changes the variable's value to The strange thing is, it works fine if I use a number instead of the Variable. It also works fine if I use a "predefined numeric format" instead of my custom one. For example, if I use:
testVar = Format$(testVar, "Standard")it works just fine, but that's not what I want (otherwise I'd just do it this way.) It also works fine when I do this:
testVar = Format$(10000, And, although in the example code I've written here, it seems like I could just do it this way, in my actual program, I can't. I have to set it dynamically with the variable.
So it seems like both portions of my Format() Function are working, but just not together, and I can't seem to figure out why. anyone shed some light on this for me and tell me what I'm doing wrong? From every example I can find on the internet about using this function with a variable, I'm doing it correctly, but mine isn't working.
var queryString = string.Format("filename={0}&filestream={1}&append={2)", fileName, Convert.ToBase64String(b, 0, bytesRead).ToString(), 1);
above line of code giving error 'Input string was not in a correct format.'
I have a function that is getting passed a String and a DataRow.The String is a custom formatter. The idea is to do this
String.Format(passed_in_String, DataRow("ColumnINeed"))
The reason this is being done is at this point we have no idea what the column contains.However, if the formatter is "{0:MM/dd/yyyy}" and the DataRow("ColumnINeed") is an integer containing 42, String.Format is returning: MM/dd/yyyy In this situation I need it to throw an exception instead of returning nonsense.Is there anyway to make String.Format throw an exception if the object does not match what the format string is expecting?
I am retrieving text from a rich edit control in an external application. The text is formatted to look something like this: Output: All is well. I'm retrieving the text using :
[Code]...
I came to a company that already has a fully grown project... but coders that worked here before me didn't follow conventions and didn't use parametrized SQL queries... as a result there is over 1000 places in a very huge project that can possibly be vulnerable to SQL injection...
I need to find a solution that will automatically detect if there is an SQL injection in the code. So, for example there is a form which allows user to enter comments regarding a product, which will be sent to database on submit... how can we make sure that a user didn't enter a harmfull query instead of a normal text?
Is there any advanced code/regular expression/magic that can detect if this text contains a piece of SQL query instead of normal harmless text? I will accept any links, pieces of code in any language or even commercial software that will do that for me.
Is there a way of converting a unix time stamp to normal format time and date in .NET?
View 3 RepliesI have a asp.net application and I uses ISO-8859-1 charset. But It is not OK. In the postback, I got ISO-8859-1 keycode. But the application response next time, it is display like this. How can convert to normal fonts.
ေနေကာင္းလား
I am trying to alter a column in an Access database in VB2008 from date to text format using the SQL string as follows "ALTER TABLE receipts ALTER COLUMN Date CHAR(10)"but whether I Use TEXT, CHAR, VARCHAR or STRING, I get a Syntax Error when I run ExecuteNonQuery.
View 2 RepliesI'm new to .net. I would like to know how to convert a text data in string or in a file into a simple byte array[ ] format.
View 3 RepliesFor some reason I can't figure this out. Here's my code. colorTextbox.Text =Format(Hex(ColorBox.Color.G), "00")What I want it to do is format the Green Hex number to be "00" instead of just "0" when the color is something like blackhis has proven to be very stressful and this Format command makes no sense to me anymore (worked differently in 2005).For one, whatever I put in the quotes ("00") is what comes out in the text box. Butaccording to the command parameters, "00" should be the format, not the actual text! So then I tried any string format I could think of (## etc.) along with switching the order and I STILL can't figure this out.
View 16 RepliesWhat would be the fasted method of get a string list of all values within [] in a string of text? For example: [client_name], are you are doing today? My name is [my_name]. The list of strings would be:
[Code]...
So I need a format string to pass to String.Format that would "move" the decimal point.I can't perform any math operations before doing the String.Format, so it has to work right off the bat.Basically I'm emulating a formatting string from a proprietary server. In it if I say:
"MR2"
for the value:
12345
The result is:
123.45
I'm close with this, but it's not spot on:
String.Format("{0:#0.##}", 12345)
an extra, but not necessary... there is also MR2Z, which moves the decimal 2 left, but if the value is 0 "" is returned.
When I attempt to read my Xml file when using a schema file I get the following error message:
Input string was not in a correct format.
If I delete the schema it read its fine so I am assuming something in schema file isn't matching the incoming data? How can I determine which line is creating the error?
I am making a program that shows a data of azimuth and elevation of a radar. Example:
Azimuth = 203.40
Elevation = 3.52
I need that the data will always be two number after the point. Even when the number ends with zero (203.40).But the Double by default removes the zero from the end of the number.
I am building a program for my CINS-113 class where it allows the user to enter a number 1-15 in a masked text box and then hit OK and it will display that number in a ListBox as such:
Say they enter 1...
1 X 1 = 1
1 X 2 = 2
1 X 3 = 3
...
1 X 12 = 12
I have gotten everything to work great, but when you enter anything but numbers 1-15 it properly provides a message popup telling you that your entry is basically not the right value, but then I get a build error that says "Input string was not in correct format" and it highlights my line: "intInput1 = Convert.ToInt32(strInput1)"
[code]...
however, i'm copying this directly from the book in its example format and still getting an error.
FormatException was unhandled
Input String was not in correct format
Public Class Form1
[Code].....
I can find lots of examples of rotated text on graphics objects on a Google search, but I want to create a vertical caption but with normal letter orientation, something like this:
C
A
P
T
I
O
N
but with sensible spacing and alignment. I can't seem to get my search terms right to find a suitable example. Can anyone point me in the right direction?
I am adding ToolTips to my forms and sometimes to get the point across my text string can get lengthily. This results in a long single line. Currently I am simply adding manual carriage returns after a test run and then making changes when it looks right. Has to be a better way.
View 3 RepliesI need to take a string formatted like '010711' (DDMMYY) and put it into format '01-Jul-11'. Ive thought about doing something like string.toArray and then having some conditionals that format from there but am looking for an easier way.
View 5 RepliesAll i want to do is write some text into word... some of the text is normal text the other is bold... how do I achieve this?The samples I have seen, they either do normal text or bold.. but in different lines utilising InsertParagraphAfter()I need to have both in the one lineie how do i do the following line? using vb.net and word automation (word 2010)
View 2 RepliesI want to to make date format dd/mm/yyyy with access 2003
Dim strdate As string="22/09/2010"
Dim dd1 As New Date
dd1= strdate
I get : Conversion from string "22/09/2010" to type 'Date' is not valid.
I have a datagrid and I need to be able to print out its content. I can get the values from the cells, place them into a text file and launch the file. My problem is that my cells just are put into the txt file in a long list and I want to be able to display them in columns with headings. I am using the following
[Code]...
I'm trying to convert the "29/09/2009" string to date format dd/mm/yyyy I'm using visual studio 2008, and i've tried the following:
dim sdate as string
sdate = "29/09/2009"
mydate = DateTime.Parse(sDate, Globalization.CultureInfo.CreateSpecificCulture("el-GR"))
and
mydate = Date.Parse(sDate).ToShortDateString()
and i always get #9/29/2009# instead of #29/09/2009# that i want
I'm trying to save a text file with a certain format, kind of trying to create some sort of colums, so when I open it will be easier to read...If I have these four words: Calendar, Car, Time, Airplane; I would like to put them into colums...
vb.net
oWriter.WriteLine("{0,50}{1,10}", "Calendar", "Airplane")
oWriter.WriteLine("{0,50}{1,10}", "Time", "Car")
The problem:When I save it to a text file or print it, it comes out like this:Calendar AirplaneTime CarHow can I put them like "centered", so that doesn't look like that mess...?
I want to format the Timespan to have format like this 49 hr 34 mn 20 sec
I used the String format below :
String.Format("{0:00}:{1:00}:{2:00}", theTimeSpan.TotalHours, theTimeSpan.Minutes, theTimeSpan.Seconds)
It formats the Timespan to this format 49:34:20. How can I add hr mn sec to the String.Format above? or there's another easy way?